Package org.drasyl.util
Class EvictingQueue<E>
java.lang.Object
org.drasyl.util.EvictingQueue<E>
- Type Parameters:
E- the type of elements held in this queue
- All Implemented Interfaces:
Iterable<E>,Collection<E>,Queue<E>
A
Queue that evicts head elements to ensure that the queue will not exceed its capacity
when new elements are enqueued.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleanaddAll(Collection<? extends E> c) voidclear()booleanbooleancontainsAll(Collection<?> c) element()booleaninthashCode()booleanisEmpty()iterator()booleanpeek()poll()remove()booleanbooleanremoveAll(Collection<?> c) booleanretainAll(Collection<?> c) intsize()Object[]toArray()<T> T[]toArray(T[] a) Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, spliterator, stream, toArray
-
Constructor Details
-
EvictingQueue
public EvictingQueue(int capacity)
-
-
Method Details
-
size
public int size()- Specified by:
sizein interfaceCollection<E>
-
isEmpty
public boolean isEmpty()- Specified by:
isEmptyin interfaceCollection<E>
-
contains
- Specified by:
containsin interfaceCollection<E>
-
iterator
-
toArray
- Specified by:
toArrayin interfaceCollection<E>
-
toArray
public <T> T[] toArray(T[] a) - Specified by:
toArrayin interfaceCollection<E>
-
add
-
remove
- Specified by:
removein interfaceCollection<E>
-
containsAll
- Specified by:
containsAllin interfaceCollection<E>
-
addAll
- Specified by:
addAllin interfaceCollection<E>
-
removeAll
- Specified by:
removeAllin interfaceCollection<E>
-
retainAll
- Specified by:
retainAllin interfaceCollection<E>
-
clear
public void clear()- Specified by:
clearin interfaceCollection<E>
-
equals
- Specified by:
equalsin interfaceCollection<E>- Overrides:
equalsin classObject
-
hashCode
public int hashCode()- Specified by:
hashCodein interfaceCollection<E>- Overrides:
hashCodein classObject
-
offer
-
remove
-
poll
-
element
-
peek
-