Package de.xima.fc.common.collection
Class OnePlusList<T>
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<T>
-
- de.xima.fc.common.collection.OnePlusList<T>
-
- Type Parameters:
T
- Type of the list items.
- All Implemented Interfaces:
Iterable<T>
,Collection<T>
,List<T>
,RandomAccess
public final class OnePlusList<T> extends AbstractList<T> implements RandomAccess
An unmodifiable list that extends another list and includes an additional item at the start.- Since:
- 8.4.0
-
-
Field Summary
-
Fields inherited from class java.util.AbstractList
modCount
-
-
Constructor Summary
Constructors Constructor Description OnePlusList(T head, List<T> tail)
Constructs a new list that includes the specified start item at the start of another list.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description T
get(int index)
int
size()
-
Methods inherited from class java.util.AbstractList
add, add, addAll, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, removeRange, set, subList
-
Methods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
Methods inherited from interface java.util.List
addAll, contains, containsAll, isEmpty, remove, removeAll, replaceAll, retainAll, sort, spliterator, toArray, toArray
-
-
-
-
Constructor Detail
-
OnePlusList
public OnePlusList(T head, List<T> tail)
Constructs a new list that includes the specified start item at the start of another list. If the start item is null, this will not affect the size, i.e. the resulting list will have a null element at the start position.- Parameters:
head
- The item to be placed at the start of the list.tail
- The parent list to be included after the start item.
-
-