I have the following class:
int x;
int y;
float distance;
public Point(int x, int y, float distance){
this.x = x;
this.y = y;
this.distance = distance;
}
}
On my main program I have this line:
PriorityQueue<Point> minHeap = new PriorityQueue<Point>( (a,b) -> ((float) a.distance - (float) b.distance) );
I keep getting this error:
PriorityQueue<Point> minHeap = new PriorityQueue<Point>( (a,b) -> ((float) a.distance - (float) b.distance) );
^
possible lossy conversion from float to int```
------------------------------------------------------------------------------------
I dont know why is not accepting my comparator method. Any ideas? thanks in advance.