Class BoundedList<E>
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractList<E>
java.util.ArrayList<E>
org.nuiton.util.BoundedList<E>
- All Implemented Interfaces:
Serializable, Cloneable, Iterable<E>, Collection<E>, List<E>, RandomAccess, SequencedCollection<E>
ArrayList with minimum and maximum sizes. For each operation, the size is
checked and the BoundedList to ensure that it is kept in the range.
Created: 10 juin 2005
- Author:
- Arnaud Thimel - thimel@codelutin.com
- See Also:
-
Field Summary
Fields inherited from class AbstractList
modCount -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new BoundedList with the default capacity.BoundedList(int initialCapacity) Creates a new BoundedList with the specified initialCapacity.BoundedList(int minSize, int maxSize) Creates a new empty BoundedList with the specified min and max sizes.BoundedList(Collection<E> arg0) Creates a new BoundedList with the specified collection of elements. -
Method Summary
Modifier and TypeMethodDescriptionvoidInserts the specified element at the specified position in this list.booleanAppends the specified element to the end of this list.booleanaddAll(int index, Collection<? extends E> c) Inserts all of the elements in the specified Collection into this list, starting at the specified position.booleanaddAll(Collection<? extends E> c) Appends all of the elements in the specified Collection to the end of this list, in the order that they are returned by the specified Collection's Iterator.clone()Returns a shallow copy of this BoundedList instancebooleanisFull()Indicates if the list size is at the maximumbooleanIndicates if the list size is to the minimumremove(int index) Removes the element at the specified position in this list.booleanRemoves a single instance of the specified element from this list, if it is present (optional operation).booleanremoveAll(Collection<?> c) Removes from this collection all of its elements that are contained in the specified collection (optional operation).protected voidremoveRange(int fromIndex, int toIndex) Removes from this List all of the elements whose index is between fromIndex, inclusive and toIndex, exclusive.toString()Methods inherited from class ArrayList
addFirst, addLast, clear, contains, ensureCapacity, equals, forEach, get, getFirst, getLast, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, removeFirst, removeIf, removeLast, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSizeMethods inherited from class AbstractCollection
containsAllMethods inherited from interface Collection
parallelStream, stream, toArrayMethods inherited from interface List
containsAll, reversed
-
Constructor Details
-
BoundedList
public BoundedList(int initialCapacity) Creates a new BoundedList with the specified initialCapacity. The min size is set to 0 and the max size to the infinite.- Parameters:
initialCapacity- FIXME
-
BoundedList
public BoundedList()Creates a new BoundedList with the default capacity. The min size is set to 0 and the max size to the infinite. -
BoundedList
Creates a new BoundedList with the specified collection of elements. The min size is set to 0 and the max size to the infinite.- Parameters:
arg0- FIXME
-
BoundedList
public BoundedList(int minSize, int maxSize) Creates a new empty BoundedList with the specified min and max sizes. Please be informed that -1 represents the infinite.- Parameters:
minSize- FIXMEmaxSize- FIXME
-
-
Method Details
-
isFull
public boolean isFull()Indicates if the list size is at the maximum- Returns:
- true is the maximum size has been reached
-
isToMinimum
public boolean isToMinimum()Indicates if the list size is to the minimum- Returns:
- true is the list size is the minimum size
-
add
-
add
-
addAll
Appends all of the elements in the specified Collection to the end of this list, in the order that they are returned by the specified Collection's Iterator. -
addAll
Inserts all of the elements in the specified Collection into this list, starting at the specified position. -
clone
-
remove
-
removeRange
protected void removeRange(int fromIndex, int toIndex) Removes from this List all of the elements whose index is between fromIndex, inclusive and toIndex, exclusive.- Overrides:
removeRangein classArrayList<E>- Parameters:
fromIndex- index of first element to be removedtoIndex- index after last element to be removed
-
remove
-
removeAll
Removes from this collection all of its elements that are contained in the specified collection (optional operation). -
toString
- Overrides:
toStringin classAbstractCollection<E>
-