|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.AbstractCollection<E>
java.util.AbstractQueue<E>
java.util.PriorityQueue<E>
public class PriorityQueue<E>
| Constructor Summary | |
|---|---|
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)
|
|
| Method Summary | |
|---|---|
boolean |
addAll(Collection<? extends E> c)
Adds all of the elements in the specified collection to this queue. |
void |
clear()
Removes all of the elements from this queue. |
Comparator<? super E> |
comparator()
|
Iterator<E> |
iterator()
Return an Iterator over this collection. |
boolean |
offer(E o)
Inserts the specified element into this queue if it is possible to do so immediately without violating capacity restrictions. |
E |
peek()
Retrieves, but does not remove, the head of this queue, or returns null if this queue is empty. |
E |
poll()
Retrieves and removes the head of this queue, or returns null if this queue is empty. |
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. |
| Methods inherited from class java.util.AbstractQueue |
|---|
add, element, remove |
| Methods inherited from class java.util.AbstractCollection |
|---|
contains, containsAll, isEmpty, removeAll, retainAll, toArray, toArray, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.Collection |
|---|
contains, containsAll, equals, hashCode, isEmpty, removeAll, retainAll, toArray, toArray |
| Constructor Detail |
|---|
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)
| Method Detail |
|---|
public void clear()
AbstractQueueThis implementation repeatedly invokes poll until it
returns null.
clear in interface Collection<E>clear in class 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 offer(E o)
QueueQueue.add(E), which can fail to insert an element only
by throwing an exception.
offer in interface Queue<E>o - the element to add
public E peek()
Queue
peek in interface Queue<E>public E poll()
Queue
poll in interface Queue<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 collection
Iterator.remove()public int size()
AbstractCollection
size in interface Collection<E>size in class AbstractCollection<E>public boolean addAll(Collection<? extends E> c)
AbstractQueueThis implementation iterates over the specified collection, and adds each element returned by the iterator to this queue, in turn. A runtime exception encountered while trying to add an element (including, in particular, a null element) may result in only some of the elements having been successfully added when the associated exception is thrown.
addAll in interface Collection<E>addAll in class AbstractQueue<E>c - collection containing elements to be added to this queue
AbstractQueue.add(Object)
|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||