Skip to content Skip to sidebar Skip to footer

Using Comparator To Sort The List Of Objects

What i am trying to do : Sort the list of objects based on distance using comparator private Point getNearestPixelValue(int pixlX, int pixlY) { LinkedList

Solution 1:

You are trying to sort a List<T>; what you should use is:

Collections.sort(theList, theComparator);

Arrays.sort() expects a T[] (an array of T) which is not quite the same thing -- in more ways than one.

Post a Comment for "Using Comparator To Sort The List Of Objects"