What i am trying to do :
Sort the list of objects based on distance using comparator
private Point getNearestPixelValue(int pixlX, int pixlY) {
LinkedList<DistancePoint> mList=new LinkedList<DistancePoint>();
for (int i = 0; i < modelModFile.getStroke_paths().size(); i++) {
for (int j = 0; j < modelModFile.getStroke_paths().get(i).getMain_stroke().size(); j++) {
if (j < modelModFile.getStroke_paths().get(i).getMain_stroke().size() - 1) {
String a = modelModFile.getStroke_paths().get(i).getMain_stroke().get(j).getStroke();
String[] fA = a.split(",");
Point p1 = new Point(Integer.valueOf(fA[0]), Integer.valueOf(fA[1]));
Point p2 = new Point(pixlX, pixlY);
//Add the calculated distance to a integerArray
DistancePoint mObj=new DistancePoint(p2,calDistBtwTwoPixels(p1, p2));
mList.add(mObj);
}
}
}
//Sort the array
Arrays.sort(mList, DistancePoint.distanceComparator);
//Return the nearest point
return mList.get(0).getmPoint();
}
DistancePoint.java
public class DistancePoint implements Comparable<DistancePoint>{
int mDistance;
Point mPoint;
public DistancePoint(Point mPoint, int mDistance) {
super();
this.mPoint = mPoint;
this.mDistance = mDistance;
}
public int getmDistance() {
return mDistance;
}
public void setmDistance(int mDistance) {
this.mDistance = mDistance;
}
public Point getmPoint() {
return mPoint;
}
public void setmPoint(Point mPoint) {
this.mPoint = mPoint;
}
public static Comparator<DistancePoint> distanceComparator = new Comparator<DistancePoint>() {
@Override
public int compare(DistancePoint e1, DistancePoint e2) {
return (int) (e1.getmDistance() - e2.getmDistance());
}
};
@Override
public int compareTo(DistancePoint distancePoint) {
//let's sort the employee based on distance in ascending order.
return (this.mDistance - distancePoint.mDistance);
}
}
Error i am getting:
How to resolve this, Not able to understand the error. am i using the comparator incorrectly

Arrays.sortbut aLinkedListis not an array. UseCollections.sortinstead. If if you want to return the nearest point, you don't need to sort it. While traversing the list, update the point as long as you find one that is nearer.