Is the order in which arguments are passed into a method (in Java) defined? For example, in the code segment
Arrays.equals(ascendingSegment, Arrays.sort(ascendingSegment))
Which is used to check if an array is in fact ordered ascending, am I guaranteed that the original array is passed in before the sort method is called on it?
EDIT:
Seems like there's a bit of a misunderstanding. Does the equals
method get a copy of the ascendingSegment before it is sorted, or is the sort called first, before the first argument is passed? Given an array such as {1, 5, 2, 4}
, will the equals method receive {1, 5, 2, 4}
and {1, 2, 4, 5}
as arguments or two copies of {1, 2, 4, 5}
?