java.util
public class PriorityQueue<E> extends java.util.AbstractQueue<E> implements Serializable
Constructor and Description |
---|
PriorityQueue() |
PriorityQueue(Collection<? extends E> c) |
PriorityQueue(int cap) |
PriorityQueue(int cap,
Comparator<? super E> comp) |
PriorityQueue(PriorityQueue<? extends E> c) |
PriorityQueue(SortedSet<? extends E> c) |
Modifier and Type | Method and Description |
---|---|
boolean |
addAll(Collection<? extends E> c)
Add all the elements of a given collection to this collection (optional
operation).
|
void |
clear()
Remove all elements from the collection (optional operation).
|
Comparator<? super E> |
comparator() |
Iterator<E> |
iterator()
Return an Iterator over this collection.
|
boolean |
offer(E o) |
E |
peek() |
E |
poll() |
boolean |
remove(Object o)
Remove a single instance of an object from this collection (optional
operation).
|
int |
size()
Return the number of elements in this collection.
|
contains, containsAll, isEmpty, removeAll, retainAll, toArray, toArray, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
contains, containsAll, equals, hashCode, isEmpty, removeAll, retainAll, toArray, toArray
public PriorityQueue()
public PriorityQueue(Collection<? extends E> c)
public PriorityQueue(int cap)
public PriorityQueue(int cap, Comparator<? super E> comp)
public PriorityQueue(PriorityQueue<? extends E> c)
public PriorityQueue(SortedSet<? extends E> c)
public void clear()
AbstractCollection
clear
in interface Collection<E>
clear
in class java.util.AbstractQueue<E>
Iterator.remove()
public Comparator<? super E> comparator()
public Iterator<E> iterator()
AbstractCollection
iterator
in interface Iterable<E>
iterator
in interface Collection<E>
iterator
in class AbstractCollection<E>
public boolean remove(Object o)
AbstractCollection
(o == null ? e == null : o.equals(e))
, if such an element
exists. This implementation obtains an iterator over the collection
and iterates over it, testing each element for equality with the given
object. If it is equal, it is removed by the iterator's remove method
(thus this method will fail with an UnsupportedOperationException if
the Iterator's remove method does). After the first element has been
removed, true is returned; if the end of the collection is reached, false
is returned.remove
in interface Collection<E>
remove
in class AbstractCollection<E>
o
- the object to remove from this collectionIterator.remove()
public int size()
AbstractCollection
size
in interface Collection<E>
size
in class AbstractCollection<E>
public boolean addAll(Collection<? extends E> c)
AbstractCollection
addAll
in interface Collection<E>
addAll
in class java.util.AbstractQueue<E>
c
- the collection to add the elements of to this collectionAbstractCollection.add(Object)