Ad
  • Default User Avatar

    In general, it's not a good practice to reassign the method argument.
    If you are curious why - then please look at these method signatures.
    It's a pretty helpful example because Node arguments have a meaningful name (and in general they must be meaningful).
    And then if we treat an argument head as a usual variable its name becomes pointless.
    And moreover in the case, if a method is much larger than a few lines or has an intricate logic then it's easy to introduce a bug because you forget that 'head' no longer points to the head.