I have a class 'Point'. I want to sort an array of points, but I want to use 2 "compare" functions (I want to take 2 arrays, one with the points sorted by X and the other by Y). How can I make my class accept 2 comparing functions? Here's my code
static class Point implements Comparator<Point>{
int x,y;
int compareX(Point A , Point B){
return A.x - B.x;
}
int compareY(Point A , Point B){
return A.y - B.y;
}
}