Class PriorityLinkedListImpl<E>
- java.lang.Object
-
- org.apache.activemq.artemis.utils.collections.PriorityLinkedListImpl<E>
-
- All Implemented Interfaces:
PriorityLinkedList<E>
public class PriorityLinkedListImpl<E> extends Object implements PriorityLinkedList<E>
A priority linked list implementationIt implements this by maintaining an individual LinkedBlockingDeque for each priority level.
-
-
Field Summary
Fields Modifier and Type Field Description protected LinkedListImpl<E>[]
levels
-
Constructor Summary
Constructors Constructor Description PriorityLinkedListImpl(int priorities)
PriorityLinkedListImpl(int priorities, Comparator<E> comparator)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addHead(E e, int priority)
void
addSorted(E e, int priority)
void
addTail(E e, int priority)
void
clear()
boolean
isEmpty()
Returnstrue
if empty,false
otherwise.
It is safe to be called concurrently.LinkedListIterator<E>
iterator()
E
peek()
just look at the first element on the listE
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.
-
-
-
Field Detail
-
levels
protected final LinkedListImpl<E>[] levels
-
-
Constructor Detail
-
PriorityLinkedListImpl
public PriorityLinkedListImpl(int priorities)
-
PriorityLinkedListImpl
public PriorityLinkedListImpl(int priorities, Comparator<E> comparator)
-
-
Method Detail
-
addHead
public void addHead(E e, int priority)
- Specified by:
addHead
in interfacePriorityLinkedList<E>
-
addTail
public void addTail(E e, int priority)
- Specified by:
addTail
in interfacePriorityLinkedList<E>
-
addSorted
public void addSorted(E e, int priority)
- Specified by:
addSorted
in interfacePriorityLinkedList<E>
-
setNodeStore
public void setNodeStore(NodeStore<E> supplier)
- Specified by:
setNodeStore
in interfacePriorityLinkedList<E>
- See Also:
LinkedList.setNodeStore(NodeStore)
-
removeWithID
public E removeWithID(String listID, long id)
- Specified by:
removeWithID
in interfacePriorityLinkedList<E>
-
peek
public E peek()
Description copied from interface:PriorityLinkedList
just look at the first element on the list- Specified by:
peek
in interfacePriorityLinkedList<E>
-
poll
public E poll()
- Specified by:
poll
in interfacePriorityLinkedList<E>
-
clear
public void clear()
- Specified by:
clear
in interfacePriorityLinkedList<E>
-
size
public int size()
Description copied from interface:PriorityLinkedList
Returns the size of this list.
It is safe to be called concurrently.- Specified by:
size
in interfacePriorityLinkedList<E>
-
isEmpty
public boolean isEmpty()
Description copied from interface:PriorityLinkedList
Returnstrue
if empty,false
otherwise.
It is safe to be called concurrently.- Specified by:
isEmpty
in interfacePriorityLinkedList<E>
-
iterator
public LinkedListIterator<E> iterator()
- Specified by:
iterator
in interfacePriorityLinkedList<E>
-
-