| Method | Description |
|---|---|
copyOf(array, newSize) | returns a copy of the array with the given size |
copyOfRange(array, startIndex, endIndex) | returns a copy of the selection specified of the given array - from startIndex (inc) to endIndex (excl) |
equals(array1, array2) | returns true if the arrays contain the same elements |
fill(array, value) | sets every element of the array to the given value |
sort(array) | rearranges the elements of the array so they appear in non-decreasing order |
toString(array) | retuns a String representation of the array, as in [3, 5, 7] |
... | ... |
So the way to compare Arrays is the same as comparing Strings - instead of using ==, you need to use Arrays.equal. I assume this is true for everything that isn't a primitive data type.
No comments:
Post a Comment