Class PriorityCollection<E extends PriorityAware>
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- org.apache.activemq.artemis.utils.collections.PriorityCollection<E>
-
- Type Parameters:
E- The type this class may hold, this is generic as can be anything that extends PriorityAware.
- All Implemented Interfaces:
Iterable<E>,Collection<E>
public class PriorityCollection<E extends PriorityAware> extends AbstractCollection<E>
This class's purpose is to hold the the different collections used for each priority level. A supplier is required to provide the underlying collection needed when a new priority level is seen, and the end behaviour is that of the underlying collection, e.g. if set add will follow set's add semantics, if list, then list semantics. Methods getArray, setArray MUST never be exposed, and all array modifications must go through these.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classPriorityCollection.PriorityHolder<E>
-
Constructor Summary
Constructors Constructor Description PriorityCollection(Supplier<Collection<E>> supplier)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanadd(E e)booleanaddAll(Collection<? extends E> c)voidclear()booleancontains(Object o)booleancontains(PriorityAware priorityAware)booleancontainsAll(Collection<?> c)voidforEach(Consumer<? super E> action)Set<Integer>getPriorites()booleanisEmpty()Iterator<E>iterator()booleanremove(Object o)booleanremoveAll(Collection<?> c)ResettableIterator<E>resettableIterator()booleanretainAll(Collection<?> c)intsize()-
Methods inherited from class java.util.AbstractCollection
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
equals, hashCode, parallelStream, removeIf, spliterator, stream, toArray
-
-
-
-
Constructor Detail
-
PriorityCollection
public PriorityCollection(Supplier<Collection<E>> supplier)
-
-
Method Detail
-
size
public int size()
- Specified by:
sizein interfaceCollection<E extends PriorityAware>- Specified by:
sizein classAbstractCollection<E extends PriorityAware>
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmptyin interfaceCollection<E extends PriorityAware>- Overrides:
isEmptyin classAbstractCollection<E extends PriorityAware>
-
iterator
public Iterator<E> iterator()
- Specified by:
iteratorin interfaceCollection<E extends PriorityAware>- Specified by:
iteratorin interfaceIterable<E extends PriorityAware>- Specified by:
iteratorin classAbstractCollection<E extends PriorityAware>
-
resettableIterator
public ResettableIterator<E> resettableIterator()
-
add
public boolean add(E e)
- Specified by:
addin interfaceCollection<E extends PriorityAware>- Overrides:
addin classAbstractCollection<E extends PriorityAware>
-
remove
public boolean remove(Object o)
- Specified by:
removein interfaceCollection<E extends PriorityAware>- Overrides:
removein classAbstractCollection<E extends PriorityAware>
-
containsAll
public boolean containsAll(Collection<?> c)
- Specified by:
containsAllin interfaceCollection<E extends PriorityAware>- Overrides:
containsAllin classAbstractCollection<E extends PriorityAware>
-
addAll
public boolean addAll(Collection<? extends E> c)
- Specified by:
addAllin interfaceCollection<E extends PriorityAware>- Overrides:
addAllin classAbstractCollection<E extends PriorityAware>
-
removeAll
public boolean removeAll(Collection<?> c)
- Specified by:
removeAllin interfaceCollection<E extends PriorityAware>- Overrides:
removeAllin classAbstractCollection<E extends PriorityAware>
-
retainAll
public boolean retainAll(Collection<?> c)
- Specified by:
retainAllin interfaceCollection<E extends PriorityAware>- Overrides:
retainAllin classAbstractCollection<E extends PriorityAware>
-
clear
public void clear()
- Specified by:
clearin interfaceCollection<E extends PriorityAware>- Overrides:
clearin classAbstractCollection<E extends PriorityAware>
-
contains
public boolean contains(Object o)
- Specified by:
containsin interfaceCollection<E extends PriorityAware>- Overrides:
containsin classAbstractCollection<E extends PriorityAware>
-
contains
public boolean contains(PriorityAware priorityAware)
-
-