java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractList<E>
java.util.AbstractSequentialList<E>
java.util.LinkedList<E>
org.sejda.commons.collection.CircularLinkedList<E>
- All Implemented Interfaces:
Serializable,Cloneable,Iterable<E>,Collection<E>,Deque<E>,List<E>,Queue<E>
A
LinkedList with size constraints. When at maxCapacity and an element is added, the eldest element is removed.- See Also:
-
Field Summary
FieldsFields inherited from class java.util.AbstractList
modCount -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidbooleanbooleanaddAll(int index, Collection<? extends E> c) booleanaddAll(Collection<? extends E> c) voidvoidintprivate voidMakes the list fit its limits by removing last items in cases where the list might have exceeded its limits.booleanisFull()private voidmakeRoom()Makes a space available if the list is already full.voidsetMaxCapacity(int maxCapacity) Methods inherited from class java.util.LinkedList
clear, clone, contains, descendingIterator, element, get, getFirst, getLast, indexOf, lastIndexOf, listIterator, offer, offerFirst, offerLast, peek, peekFirst, peekLast, poll, pollFirst, pollLast, pop, push, remove, remove, remove, removeFirst, removeFirstOccurrence, removeLast, removeLastOccurrence, set, size, spliterator, toArray, toArrayMethods inherited from class java.util.AbstractSequentialList
iteratorMethods inherited from class java.util.AbstractList
equals, hashCode, listIterator, removeRange, subListMethods inherited from class java.util.AbstractCollection
containsAll, isEmpty, removeAll, retainAll, toStringMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface java.util.List
containsAll, equals, hashCode, isEmpty, iterator, listIterator, removeAll, replaceAll, retainAll, sort, subList
-
Field Details
-
maxCapacity
private int maxCapacity
-
-
Constructor Details
-
CircularLinkedList
public CircularLinkedList(int maxCapacity)
-
-
Method Details
-
setMaxCapacity
public void setMaxCapacity(int maxCapacity) -
getMaxCapacity
public int getMaxCapacity() -
isFull
public boolean isFull() -
addFirst
-
addLast
-
add
-
addAll
-
addAll
-
add
-
makeRoom
private void makeRoom()Makes a space available if the list is already full. Calling this prior the insertion avoids that the list exceeds its limits. -
houseKeep
private void houseKeep()Makes the list fit its limits by removing last items in cases where the list might have exceeded its limits.
-