0

Can anyone tell the difference between

  1. Arrays.sort(points, (a, b) -> Integer.compare(a[1], b[1]));

  2. Arrays.sort(points, (a, b) ->{ return a[1] - b[1]; });

1 Answers1

-2

These are (essentially) functionally the same, as per documentation

Integer.compare(x, y) returns "the value 0 if x == y; a value less than 0 if x < y; and a value greater than 0 if x > y"

Ewan Brown
  • 640
  • 3
  • 12