java.lang.Iterable<E>
, java.util.Collection<E>
, BoundedCollection<E>
public class FixedSizeList<E> extends AbstractSerializableListDecorator<E> implements BoundedCollection<E>
List
to fix the size preventing add/remove.
The add, remove, clear and retain operations are unsupported. The set method is allowed (as it doesn't change the list size).
This class is Serializable from Commons Collections 3.1.
Modifier | Constructor | Description |
---|---|---|
protected |
FixedSizeList(java.util.List<E> list) |
Constructor that wraps (not copies).
|
Modifier and Type | Method | Description |
---|---|---|
void |
add(int index,
E object) |
|
boolean |
add(E object) |
|
boolean |
addAll(int index,
java.util.Collection<? extends E> coll) |
|
boolean |
addAll(java.util.Collection<? extends E> coll) |
|
void |
clear() |
|
static <E> FixedSizeList<E> |
fixedSizeList(java.util.List<E> list) |
Factory method to create a fixed size list.
|
E |
get(int index) |
|
int |
indexOf(java.lang.Object object) |
|
boolean |
isFull() |
Returns true if this collection is full and no new elements can be added.
|
java.util.Iterator<E> |
iterator() |
|
int |
lastIndexOf(java.lang.Object object) |
|
java.util.ListIterator<E> |
listIterator() |
|
java.util.ListIterator<E> |
listIterator(int index) |
|
int |
maxSize() |
Gets the maximum size of the collection (the bound).
|
E |
remove(int index) |
|
boolean |
remove(java.lang.Object object) |
|
boolean |
removeAll(java.util.Collection<?> coll) |
|
boolean |
retainAll(java.util.Collection<?> coll) |
|
E |
set(int index,
E object) |
|
java.util.List<E> |
subList(int fromIndex,
int toIndex) |
contains, containsAll, isEmpty, setCollection, size, toArray, toArray, toString
decorated, equals, hashCode
contains, containsAll, equals, hashCode, isEmpty, parallelStream, removeIf, size, spliterator, stream, toArray, toArray
protected FixedSizeList(java.util.List<E> list)
list
- the list to decorate, must not be nulljava.lang.NullPointerException
- if list is nullpublic static <E> FixedSizeList<E> fixedSizeList(java.util.List<E> list)
E
- the type of the elements in the listlist
- the list to decorate, must not be nulljava.lang.NullPointerException
- if list is nullpublic boolean add(E object)
add
in interface java.util.Collection<E>
add
in class AbstractCollectionDecorator<E>
public void add(int index, E object)
add
in class AbstractListDecorator<E>
public boolean addAll(java.util.Collection<? extends E> coll)
addAll
in interface java.util.Collection<E>
addAll
in class AbstractCollectionDecorator<E>
public boolean addAll(int index, java.util.Collection<? extends E> coll)
addAll
in class AbstractListDecorator<E>
public void clear()
clear
in interface java.util.Collection<E>
clear
in class AbstractCollectionDecorator<E>
public E get(int index)
get
in class AbstractListDecorator<E>
public int indexOf(java.lang.Object object)
indexOf
in class AbstractListDecorator<E>
public java.util.Iterator<E> iterator()
iterator
in interface java.util.Collection<E>
iterator
in interface java.lang.Iterable<E>
iterator
in class AbstractCollectionDecorator<E>
public int lastIndexOf(java.lang.Object object)
lastIndexOf
in class AbstractListDecorator<E>
public java.util.ListIterator<E> listIterator()
listIterator
in class AbstractListDecorator<E>
public java.util.ListIterator<E> listIterator(int index)
listIterator
in class AbstractListDecorator<E>
public E remove(int index)
remove
in class AbstractListDecorator<E>
public boolean remove(java.lang.Object object)
remove
in interface java.util.Collection<E>
remove
in class AbstractCollectionDecorator<E>
public boolean removeAll(java.util.Collection<?> coll)
removeAll
in interface java.util.Collection<E>
removeAll
in class AbstractCollectionDecorator<E>
public boolean retainAll(java.util.Collection<?> coll)
retainAll
in interface java.util.Collection<E>
retainAll
in class AbstractCollectionDecorator<E>
public E set(int index, E object)
set
in class AbstractListDecorator<E>
public java.util.List<E> subList(int fromIndex, int toIndex)
subList
in class AbstractListDecorator<E>
public boolean isFull()
BoundedCollection
isFull
in interface BoundedCollection<E>
true
if the collection is fullpublic int maxSize()
BoundedCollection
maxSize
in interface BoundedCollection<E>
Copyright © 2001-2019 - Apache Software Foundation