Java - Collections.binarySearch with PriorityQueue?
Posted
by msr
on Stack Overflow
See other posts from Stack Overflow
or by msr
Published on 2010-05-21T21:58:14Z
Indexed on
2010/05/21
22:00 UTC
Read the original article
Hit count: 387
Hello,
Can I use Collections.binarySearch() method to search elements in a PriorityQueue? Otherwise, how can I apply search algorithms to a PriorityQueue?
I have this (class Evento implements Comparable):
public class PriorityQueueCAP extends PriorityQueue<Evento>{
// (...)
public void removeEventos(Evento evento){
Collections.binarySearch(this, evento); // ERROR!
}
}
And I got this error: "The method binarySearch(List>, T) in the type Collections is not applicable for the arguments (PriorityQueueCAP, Evento)"
Why?
Thanks in advance!
© Stack Overflow or respective owner