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
-
Method Summary
Modifier and TypeMethodDescriptionboolean
boolean
addAll
(Collection<? extends E> c) void
clear()
boolean
boolean
containsAll
(Collection<?> c) element()
boolean
int
hashCode()
boolean
isEmpty()
iterator()
boolean
peek()
poll()
remove()
boolean
boolean
removeAll
(Collection<?> c) boolean
retainAll
(Collection<?> c) int
size()
Object[]
toArray()
<T> T[]
toArray
(T[] a) Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods 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:
size
in interfaceCollection<E>
-
isEmpty
public boolean isEmpty()- Specified by:
isEmpty
in interfaceCollection<E>
-
contains
- Specified by:
contains
in interfaceCollection<E>
-
iterator
-
toArray
- Specified by:
toArray
in interfaceCollection<E>
-
toArray
public <T> T[] toArray(T[] a) - Specified by:
toArray
in interfaceCollection<E>
-
add
-
remove
- Specified by:
remove
in interfaceCollection<E>
-
containsAll
- Specified by:
containsAll
in interfaceCollection<E>
-
addAll
- Specified by:
addAll
in interfaceCollection<E>
-
removeAll
- Specified by:
removeAll
in interfaceCollection<E>
-
retainAll
- Specified by:
retainAll
in interfaceCollection<E>
-
clear
public void clear()- Specified by:
clear
in interfaceCollection<E>
-
equals
- Specified by:
equals
in interfaceCollection<E>
- Overrides:
equals
in classObject
-
hashCode
public int hashCode()- Specified by:
hashCode
in interfaceCollection<E>
- Overrides:
hashCode
in classObject
-
offer
-
remove
-
poll
-
element
-
peek
-