public class UpdatablePriorityQueue<T> extends AbstractCollection<T> implements Queue<T>
| Constructor and Description |
|---|
UpdatablePriorityQueue(Collection<? extends T> coll,
Comparator<? super T> c)
Construct a PriorityQueue from another Collection.
|
UpdatablePriorityQueue(Comparator<? super T> c)
Construct an empty PriorityQueue with a specified comparator.
|
UpdatablePriorityQueue(int initialSize,
Comparator<? super T> c)
Construct a PriorityQueue with an initial size and a specified comparator that can be null if natural .
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(T x) |
void |
clear() |
T |
element() |
Iterator<T> |
iterator()
Returns an iterator over the elements in this PriorityQueue.
|
boolean |
offer(T x) |
T |
peek() |
T |
poll() |
T |
remove() |
T |
replace(T newElement)
Replaces the current head element with the given element.
|
int |
size() |
void |
update()
Updates the queue when the priority of head element and only the the priority of the head element changes.
|
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitaddAll, contains, containsAll, equals, hashCode, isEmpty, parallelStream, remove, removeAll, removeIf, retainAll, spliterator, stream, toArray, toArraypublic UpdatablePriorityQueue(Comparator<? super T> c)
public UpdatablePriorityQueue(Collection<? extends T> coll, Comparator<? super T> c)
public UpdatablePriorityQueue(int initialSize,
Comparator<? super T> c)
public boolean add(T x)
add in interface Collection<T>add in interface Queue<T>add in class AbstractCollection<T>public int size()
size in interface Collection<T>size in class AbstractCollection<T>public void clear()
clear in interface Collection<T>clear in class AbstractCollection<T>public Iterator<T> iterator()
iterator in interface Iterable<T>iterator in interface Collection<T>iterator in class AbstractCollection<T>public void update()
public T replace(T newElement)
public T replace(T newElement) {
T result = queue.remove();
queue.add(newElement);
return result;
}
Copyright © 2010-2016 Stardog Union. All Rights Reserved.