Package net.shibboleth.shared.collection

# Class LazyList<ElementType>

java.lang.Object
net.shibboleth.shared.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>`
`delegate`
Delegate list.
`private static final long`
`serialVersionUID`
Serial version UID.

## Constructor Summary

Constructors
Constructor
Description
`LazyList()`

## Method Summary

Modifier and Type
Method
Description
`void`
`add(int index, ElementType element)`
`boolean`
`add(ElementType item)`
`boolean`
`addAll(int index, Collection<? extends ElementType> collection)`
`boolean`
`addAll(Collection<? extends ElementType> collection)`
`protected List<ElementType>`
`buildList()`
Builds an appropriate delegate for this list.
`void`
`clear()`
`boolean`
`contains(Object element)`
`boolean`
`containsAll(Collection<?> collections)`
`boolean`
`equals(Object obj)`
`ElementType`
`get(int index)`
`int`
`hashCode()`
`int`
`indexOf(Object element)`
`boolean`
`isEmpty()`
`Iterator<ElementType>`
`iterator()`
`int`
`lastIndexOf(Object element)`
`ListIterator<ElementType>`
`listIterator()`
`ListIterator<ElementType>`
`listIterator(int index)`
`ElementType`
`remove(int index)`
`boolean`
`remove(Object element)`
`boolean`
`removeAll(Collection<?> collection)`
`boolean`
`retainAll(Collection<?> collection)`
`ElementType`
`set(int index, ElementType element)`
`int`
`size()`
`List<ElementType>`
`subList(int fromIndex, int toIndex)`
`Object[]`
`toArray()`
`<T> T[]`
`toArray(T[] type)`
`String`
`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.lang.Iterable

`forEach`

### Methods inherited from interface java.util.List

`replaceAll, sort, spliterator`

## Field Details

### serialVersionUID

private static final long serialVersionUID
Serial version UID.

See Also:
  - Constant Field Values

### delegate

@Nonnull private List<ElementType> delegate
Delegate list.

## Constructor Details

### LazyList

public LazyList()

## Method Details

### add

public boolean add(ElementType item)

Specified by:
  `add` in interface `Collection<ElementType>`
Specified by:
  `add` in interface `List<ElementType>`

### add

public void add(int index, ElementType element)

Specified by:
  `add` in interface `List<ElementType>`

### addAll

public boolean addAll(Collection<? extends ElementType> collection)

Specified by:
  `addAll` in interface `Collection<ElementType>`
Specified by:
  `addAll` in interface `List<ElementType>`

### addAll

public boolean addAll(int index, Collection<? extends ElementType> collection)

Specified by:
  `addAll` in interface `List<ElementType>`

### clear

public void clear()

Specified by:
  `clear` in interface `Collection<ElementType>`
Specified by:
  `clear` in interface `List<ElementType>`

### contains

public boolean contains(Object element)

Specified by:
  `contains` in interface `Collection<ElementType>`
Specified by:
  `contains` in interface `List<ElementType>`

### containsAll

public boolean containsAll(Collection<?> collections)

Specified by:
  `containsAll` in interface `Collection<ElementType>`
Specified by:
  `containsAll` in interface `List<ElementType>`

### get

public ElementType get(int index)

Specified by:
  `get` in interface `List<ElementType>`

### indexOf

public int indexOf(Object element)

Specified by:
  `indexOf` in interface `List<ElementType>`

### isEmpty

public boolean isEmpty()

Specified by:
  `isEmpty` in interface `Collection<ElementType>`
Specified by:
  `isEmpty` in interface `List<ElementType>`

### iterator

public Iterator<ElementType> iterator()

Specified by:
  `iterator` in interface `Collection<ElementType>`
Specified by:
  `iterator` in interface `Iterable<ElementType>`
Specified by:
  `iterator` in interface `List<ElementType>`

### lastIndexOf

public int lastIndexOf(Object element)

Specified by:
  `lastIndexOf` in interface `List<ElementType>`

### listIterator

public ListIterator<ElementType> listIterator()

Specified by:
  `listIterator` in interface `List<ElementType>`

### listIterator

public ListIterator<ElementType> listIterator(int index)

Specified by:
  `listIterator` in interface `List<ElementType>`

### remove

public boolean remove(Object element)

Specified by:
  `remove` in interface `Collection<ElementType>`
Specified by:
  `remove` in interface `List<ElementType>`

### remove

public ElementType remove(int index)

Specified by:
  `remove` in interface `List<ElementType>`

### removeAll

public boolean removeAll(Collection<?> collection)

Specified by:
  `removeAll` in interface `Collection<ElementType>`
Specified by:
  `removeAll` in interface `List<ElementType>`

### retainAll

public boolean retainAll(Collection<?> collection)

Specified by:
  `retainAll` in interface `Collection<ElementType>`
Specified by:
  `retainAll` in interface `List<ElementType>`

### set

public ElementType set(int index, ElementType element)

Specified by:
  `set` in interface `List<ElementType>`

### size

public int size()

Specified by:
  `size` in interface `Collection<ElementType>`
Specified by:
  `size` in interface `List<ElementType>`

### subList

public List<ElementType> subList(int fromIndex, int toIndex)

Specified by:
  `subList` in interface `List<ElementType>`

### toArray

public Object[] toArray()

Specified by:
  `toArray` in interface `Collection<ElementType>`
Specified by:
  `toArray` in interface `List<ElementType>`

### toArray

public <T> T[] toArray(T[] type)

Specified by:
  `toArray` in interface `Collection<ElementType>`
Specified by:
  `toArray` in interface `List<ElementType>`

### buildList

@Nonnull protected List<ElementType> buildList()
Builds an appropriate delegate for this list.

Returns:
  delegate for this list

### toString

public String toString()

Overrides:
  `toString` in class `Object`

### hashCode

public int hashCode()

Specified by:
  `hashCode` in interface `Collection<ElementType>`
Specified by:
  `hashCode` in interface `List<ElementType>`
Overrides:
  `hashCode` in class `Object`

### equals

public boolean equals(Object obj)

Specified by:
  `equals` in interface `Collection<ElementType>`
Specified by:
  `equals` in interface `List<ElementType>`
Overrides:
  `equals` in class `Object`