J
jimi_usenet
Hi all,
I have a class MaxCapacityPriorityQueue that extends
java.util.PriorityQueue, and has the added functionallity that it has a
maximum capacity, and it doesn't grow above this limit (when the queue
is full and an additional object is added, it removes the last object
in the queue, ie the "smallest" one according to the comparator). All
this works fine.
But now I would like to check the "biggest" (according to the
comparator) object in the queue, ie the one in the tail. But there is
no such function. I only see peek() and poll() wich gives me the
*head*.
Is there a better priority queue out there, that has this
functionallity? Or is there a way for me to add it in my subclass of
PriorityQueue? The internal Object[] queue in this class is private, so
I can't access it directly.
I have a class MaxCapacityPriorityQueue that extends
java.util.PriorityQueue, and has the added functionallity that it has a
maximum capacity, and it doesn't grow above this limit (when the queue
is full and an additional object is added, it removes the last object
in the queue, ie the "smallest" one according to the comparator). All
this works fine.
But now I would like to check the "biggest" (according to the
comparator) object in the queue, ie the one in the tail. But there is
no such function. I only see peek() and poll() wich gives me the
*head*.
Is there a better priority queue out there, that has this
functionallity? Or is there a way for me to add it in my subclass of
PriorityQueue? The internal Object[] queue in this class is private, so
I can't access it directly.