This is something simple but I'm obviously missing something....
I have a 2D array that contains integer representations of Color values that have been calculated from a BufferedImage object. I also have a method to calculate the brightness value based on the integer values.
I want to sort rows based on the brightness value. However, I'm getting
sort(java.lang.Integer[], Comparator<? super Integer>) in Arrays cannot be applied
to (int[], IntComparator)
My comparator method:
private class IntComparator implements Comparator<Integer>{
@Override
public int compare(Integer x, Integer y){
return (PhotoUtils.getBrightnessValue(x) <= PhotoUtils.getBrightnessValue(y)) ? x : y;
}
}
Inside my sortRow method, I have
public void sortRow(int row) {
Arrays.sort(this.buffer[row], new IntComparator());
}
What is the issue here? After all, I'm just calculating two integer values based on the input and returning either < 0 or > 0.