Package net.solarnetwork.util
Class LimitedSizeDeque<E>
java.lang.Object
java.util.AbstractCollection<E>
java.util.ArrayDeque<E>
net.solarnetwork.util.LimitedSizeDeque<E>
- All Implemented Interfaces:
Serializable,Cloneable,Iterable<E>,Collection<E>,Deque<E>,Queue<E>
A non-blocking
Deque with an enforced maximum number of elements.
Calls to addFirst(Object) and
addLast(Object) will remove elements to make room for the addition,
before adding the new element. The removal is done from the opposite size of
the deque.
- Since:
- 1.51
- Version:
- 1.0
- Author:
- matt
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Methods inherited from class java.util.ArrayDeque
add, addAll, clear, clone, contains, descendingIterator, element, forEach, getFirst, getLast, isEmpty, iterator, offer, offerFirst, offerLast, peek, peekFirst, peekLast, poll, pollFirst, pollLast, pop, push, remove, remove, removeAll, removeFirst, removeFirstOccurrence, removeIf, removeLast, removeLastOccurrence, retainAll, size, spliterator, toArray, toArrayMethods inherited from class java.util.AbstractCollection
containsAll, toStringMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
clear, containsAll, equals, hashCode, isEmpty, parallelStream, removeAll, removeIf, retainAll, spliterator, stream, toArray, toArray, toArrayMethods inherited from interface java.util.Deque
add, addAll, contains, descendingIterator, element, getFirst, getLast, iterator, offer, offerFirst, offerLast, peek, peekFirst, peekLast, poll, pollFirst, pollLast, pop, push, remove, remove, removeFirst, removeFirstOccurrence, removeLast, removeLastOccurrence, size
-
Constructor Details
-
LimitedSizeDeque
public LimitedSizeDeque(int maximumSize) Constructor.- Parameters:
maximumSize- the maximum number of elements allowed
-
-
Method Details