Java DSA Priority Queue not working why giving error

PriorityQueue pq = new PriorityQueue<>((a, b) -> {
if( Math.abs(a-x) < Math.abs(b-x) ) {
return 1;
}
else if(Math.abs(a-x) == Math.abs(b-x)) {
if(a == b)
return 1;
else if(a < b)
return 1;
else
return -1;
}
else {
return -1;
}
});