Package com.globalmentor.collections
Class ListDecorator<E>
- java.lang.Object
-
- com.globalmentor.collections.CollectionDecorator<E>
-
- com.globalmentor.collections.ListDecorator<E>
-
- Type Parameters:
E
- The type of element contained in the list.
- All Implemented Interfaces:
java.lang.Iterable<E>
,java.util.Collection<E>
,java.util.List<E>
- Direct Known Subclasses:
AbstractConverterList
,DecoratorIDedMappedList
public class ListDecorator<E> extends CollectionDecorator<E> implements java.util.List<E>
A list that wraps an existing list, providing access through theList
interface.- Author:
- Garret Wilson
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.List<E>
list
The list this class decorates.-
Fields inherited from class com.globalmentor.collections.CollectionDecorator
collection
-
-
Constructor Summary
Constructors Constructor Description ListDecorator(java.util.List<E> list)
List constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(int index, E element)
boolean
addAll(int index, java.util.Collection<? extends E> c)
E
get(int index)
int
indexOf(java.lang.Object o)
int
lastIndexOf(java.lang.Object o)
java.util.ListIterator<E>
listIterator()
java.util.ListIterator<E>
listIterator(int index)
E
remove(int index)
void
replaceAll(java.util.function.UnaryOperator<E> operator)
E
set(int index, E element)
void
sort(java.util.Comparator<? super E> c)
java.util.List<E>
subList(int fromIndex, int toIndex)
-
Methods inherited from class com.globalmentor.collections.CollectionDecorator
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, parallelStream, remove, removeAll, removeIf, retainAll, size, spliterator, stream, toArray, toArray
-
-
-
-
Field Detail
-
list
protected final java.util.List<E> list
The list this class decorates.
-
-
Constructor Detail
-
ListDecorator
public ListDecorator(java.util.List<E> list)
List constructor.- Parameters:
list
- The list this list should decorate.- Throws:
java.lang.NullPointerException
- if the provided list isnull
.
-
-
Method Detail
-
addAll
public boolean addAll(int index, java.util.Collection<? extends E> c)
- Specified by:
addAll
in interfacejava.util.List<E>
-
indexOf
public int indexOf(java.lang.Object o)
- Specified by:
indexOf
in interfacejava.util.List<E>
-
lastIndexOf
public int lastIndexOf(java.lang.Object o)
- Specified by:
lastIndexOf
in interfacejava.util.List<E>
-
listIterator
public java.util.ListIterator<E> listIterator()
- Specified by:
listIterator
in interfacejava.util.List<E>
-
listIterator
public java.util.ListIterator<E> listIterator(int index)
- Specified by:
listIterator
in interfacejava.util.List<E>
-
subList
public java.util.List<E> subList(int fromIndex, int toIndex)
- Specified by:
subList
in interfacejava.util.List<E>
-
replaceAll
public void replaceAll(java.util.function.UnaryOperator<E> operator)
- Specified by:
replaceAll
in interfacejava.util.List<E>
-
-