public class PriorityLinkedListImpl<E> extends Object implements PriorityLinkedList<E>
It implements this by maintaining an individual LinkedBlockingDeque for each priority level.
| Modifier and Type | Field and Description |
|---|---|
protected LinkedListImpl<E>[] |
levels |
| Constructor and Description |
|---|
PriorityLinkedListImpl(int priorities) |
PriorityLinkedListImpl(int priorities,
Comparator<E> comparator) |
| Modifier and Type | Method and Description |
|---|---|
void |
addHead(E e,
int priority) |
void |
addSorted(E e,
int priority) |
void |
addTail(E e,
int priority) |
void |
clear() |
boolean |
isEmpty()
Returns
true if empty, false otherwise.It is safe to be called concurrently. |
LinkedListIterator<E> |
iterator() |
E |
poll() |
E |
removeWithID(String listID,
long id) |
void |
setNodeStore(NodeStore<E> supplier) |
int |
size()
Returns the size of this list.
It is safe to be called concurrently. |
protected LinkedListImpl<E>[] levels
public PriorityLinkedListImpl(int priorities)
public PriorityLinkedListImpl(int priorities,
Comparator<E> comparator)
public void addHead(E e, int priority)
addHead in interface PriorityLinkedList<E>public void addTail(E e, int priority)
addTail in interface PriorityLinkedList<E>public void addSorted(E e, int priority)
addSorted in interface PriorityLinkedList<E>public void setNodeStore(NodeStore<E> supplier)
setNodeStore in interface PriorityLinkedList<E>LinkedList.setNodeStore(NodeStore)public E removeWithID(String listID, long id)
removeWithID in interface PriorityLinkedList<E>public E poll()
poll in interface PriorityLinkedList<E>public void clear()
clear in interface PriorityLinkedList<E>public int size()
PriorityLinkedListsize in interface PriorityLinkedList<E>public boolean isEmpty()
PriorityLinkedListtrue if empty, false otherwise.isEmpty in interface PriorityLinkedList<E>public LinkedListIterator<E> iterator()
iterator in interface PriorityLinkedList<E>Copyright © 2022 The Apache Software Foundation. All rights reserved.