Class LazyList<ElementType>
- java.lang.Object
-
- net.shibboleth.utilities.java.support.collection.LazyList<ElementType>
-
- Type Parameters:
ElementType- type of elements within the list
- All Implemented Interfaces:
Serializable,Iterable<ElementType>,Collection<ElementType>,List<ElementType>
@NotThreadSafe public class LazyList<ElementType> extends Object implements List<ElementType>, Serializable
A list that is lazy initialized. This list takes very little memory when storing zero or one item.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private List<ElementType>delegateDelegate list.private static longserialVersionUIDSerial version UID.
-
Constructor Summary
Constructors Constructor Description LazyList()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(int index, ElementType element)booleanadd(ElementType item)booleanaddAll(int index, Collection<? extends ElementType> collection)booleanaddAll(Collection<? extends ElementType> collection)protected List<ElementType>buildList()Builds an appropriate delegate for this list.voidclear()booleancontains(Object element)booleancontainsAll(Collection<?> collections)booleanequals(Object obj)ElementTypeget(int index)inthashCode()intindexOf(Object element)booleanisEmpty()Iterator<ElementType>iterator()intlastIndexOf(Object element)ListIterator<ElementType>listIterator()ListIterator<ElementType>listIterator(int index)ElementTyperemove(int index)booleanremove(Object element)booleanremoveAll(Collection<?> collection)booleanretainAll(Collection<?> collection)ElementTypeset(int index, ElementType element)intsize()List<ElementType>subList(int fromIndex, int toIndex)Object[]toArray()<T> T[]toArray(T[] type)StringtoString()-
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
replaceAll, sort, spliterator
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
Serial version UID.- See Also:
- Constant Field Values
-
delegate
private List<ElementType> delegate
Delegate list.
-
-
Method Detail
-
add
public boolean add(ElementType item)
- Specified by:
addin interfaceCollection<ElementType>- Specified by:
addin interfaceList<ElementType>
-
add
public void add(int index, ElementType element)- Specified by:
addin interfaceList<ElementType>
-
addAll
public boolean addAll(Collection<? extends ElementType> collection)
- Specified by:
addAllin interfaceCollection<ElementType>- Specified by:
addAllin interfaceList<ElementType>
-
addAll
public boolean addAll(int index, Collection<? extends ElementType> collection)- Specified by:
addAllin interfaceList<ElementType>
-
clear
public void clear()
- Specified by:
clearin interfaceCollection<ElementType>- Specified by:
clearin interfaceList<ElementType>
-
contains
public boolean contains(Object element)
- Specified by:
containsin interfaceCollection<ElementType>- Specified by:
containsin interfaceList<ElementType>
-
containsAll
public boolean containsAll(Collection<?> collections)
- Specified by:
containsAllin interfaceCollection<ElementType>- Specified by:
containsAllin interfaceList<ElementType>
-
get
public ElementType get(int index)
- Specified by:
getin interfaceList<ElementType>
-
indexOf
public int indexOf(Object element)
- Specified by:
indexOfin interfaceList<ElementType>
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmptyin interfaceCollection<ElementType>- Specified by:
isEmptyin interfaceList<ElementType>
-
iterator
public Iterator<ElementType> iterator()
- Specified by:
iteratorin interfaceCollection<ElementType>- Specified by:
iteratorin interfaceIterable<ElementType>- Specified by:
iteratorin interfaceList<ElementType>
-
lastIndexOf
public int lastIndexOf(Object element)
- Specified by:
lastIndexOfin interfaceList<ElementType>
-
listIterator
public ListIterator<ElementType> listIterator()
- Specified by:
listIteratorin interfaceList<ElementType>
-
listIterator
public ListIterator<ElementType> listIterator(int index)
- Specified by:
listIteratorin interfaceList<ElementType>
-
remove
public boolean remove(Object element)
- Specified by:
removein interfaceCollection<ElementType>- Specified by:
removein interfaceList<ElementType>
-
remove
public ElementType remove(int index)
- Specified by:
removein interfaceList<ElementType>
-
removeAll
public boolean removeAll(Collection<?> collection)
- Specified by:
removeAllin interfaceCollection<ElementType>- Specified by:
removeAllin interfaceList<ElementType>
-
retainAll
public boolean retainAll(Collection<?> collection)
- Specified by:
retainAllin interfaceCollection<ElementType>- Specified by:
retainAllin interfaceList<ElementType>
-
set
public ElementType set(int index, ElementType element)
- Specified by:
setin interfaceList<ElementType>
-
size
public int size()
- Specified by:
sizein interfaceCollection<ElementType>- Specified by:
sizein interfaceList<ElementType>
-
subList
public List<ElementType> subList(int fromIndex, int toIndex)
- Specified by:
subListin interfaceList<ElementType>
-
toArray
public Object[] toArray()
- Specified by:
toArrayin interfaceCollection<ElementType>- Specified by:
toArrayin interfaceList<ElementType>
-
toArray
public <T> T[] toArray(T[] type)
- Specified by:
toArrayin interfaceCollection<ElementType>- Specified by:
toArrayin interfaceList<ElementType>
-
buildList
protected List<ElementType> buildList()
Builds an appropriate delegate for this list.- Returns:
- delegate for this list
-
hashCode
public int hashCode()
- Specified by:
hashCodein interfaceCollection<ElementType>- Specified by:
hashCodein interfaceList<ElementType>- Overrides:
hashCodein classObject
-
equals
public boolean equals(Object obj)
- Specified by:
equalsin interfaceCollection<ElementType>- Specified by:
equalsin interfaceList<ElementType>- Overrides:
equalsin classObject
-
-