I have a PriorityQueue
called Incoming
, that contains objects of type Vehicle
.
You can call the method getFuelLevel()
on all Vehicles
.
What I want to do is to sort Incoming
, so that the Vehicles
with the least fuel
are given a higher priority and are put at the front of the Queue.
I'm assuming I have to use a Comparator
here but have no idea how to do it.