E - the element typepublic class AutoPopulatingList<E> extends Object implements List<E>, Serializable
List wrapper class that allows for elements to be
 automatically populated as they are requested. This is particularly
 useful for data binding to Lists, allowing for elements
 to be created and added to the List in a "just in time" fashion.
 Note: This class is not thread-safe. To create a thread-safe version,
 use the Collections.synchronizedList(java.util.List<T>) utility methods.
 
Inspired by LazyList from Commons Collections.
| Modifier and Type | Class and Description | 
|---|---|
| static interface  | AutoPopulatingList.ElementFactory<E>Factory interface for creating elements for an index-based access
 data structure such as a  List. | 
| static class  | AutoPopulatingList.ElementInstantiationExceptionException to be thrown from ElementFactory. | 
| Constructor and Description | 
|---|
| AutoPopulatingList(AutoPopulatingList.ElementFactory<E> elementFactory)Creates a new  AutoPopulatingListthat is backed by a standardArrayListand creates new elements on demand using the suppliedAutoPopulatingList.ElementFactory. | 
| AutoPopulatingList(Class<? extends E> elementClass)Creates a new  AutoPopulatingListthat is backed by a standardArrayListand adds new instances of the suppliedelement Classto the backingListon demand. | 
| AutoPopulatingList(List<E> backingList,
                  AutoPopulatingList.ElementFactory<E> elementFactory)Creates a new  AutoPopulatingListthat is backed by the suppliedListand creates new elements on demand using the suppliedAutoPopulatingList.ElementFactory. | 
| AutoPopulatingList(List<E> backingList,
                  Class<? extends E> elementClass)Creates a new  AutoPopulatingListthat is backed by the suppliedListand adds new instances of the suppliedelement Classto the backingListon demand. | 
| Modifier and Type | Method and Description | 
|---|---|
| boolean | add(E o) | 
| void | add(int index,
   E element) | 
| boolean | addAll(Collection<? extends E> c) | 
| boolean | addAll(int index,
      Collection<? extends E> c) | 
| void | clear() | 
| boolean | contains(Object o) | 
| boolean | containsAll(Collection<?> c) | 
| boolean | equals(Object other) | 
| E | get(int index)Get the element at the supplied index, creating it if there is
 no element at that index. | 
| int | hashCode() | 
| int | indexOf(Object o) | 
| boolean | isEmpty() | 
| Iterator<E> | iterator() | 
| int | lastIndexOf(Object o) | 
| ListIterator<E> | listIterator() | 
| ListIterator<E> | listIterator(int index) | 
| E | remove(int index) | 
| boolean | remove(Object o) | 
| boolean | removeAll(Collection<?> c) | 
| boolean | retainAll(Collection<?> c) | 
| E | set(int index,
   E element) | 
| int | size() | 
| List<E> | subList(int fromIndex,
       int toIndex) | 
| Object[] | toArray() | 
| <T> T[] | toArray(T[] a) | 
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitreplaceAll, sort, spliteratorparallelStream, removeIf, streampublic AutoPopulatingList(Class<? extends E> elementClass)
AutoPopulatingList that is backed by a standard
 ArrayList and adds new instances of the supplied element Class
 to the backing List on demand.public AutoPopulatingList(List<E> backingList, Class<? extends E> elementClass)
AutoPopulatingList that is backed by the supplied List
 and adds new instances of the supplied element Class to the backing
 List on demand.public AutoPopulatingList(AutoPopulatingList.ElementFactory<E> elementFactory)
AutoPopulatingList that is backed by a standard
 ArrayList and creates new elements on demand using the supplied AutoPopulatingList.ElementFactory.public AutoPopulatingList(List<E> backingList, AutoPopulatingList.ElementFactory<E> elementFactory)
AutoPopulatingList that is backed by the supplied List
 and creates new elements on demand using the supplied AutoPopulatingList.ElementFactory.public boolean add(E o)
public boolean addAll(Collection<? extends E> c)
public boolean addAll(int index,
                      Collection<? extends E> c)
public void clear()
public boolean contains(Object o)
public boolean containsAll(Collection<?> c)
containsAll in interface Collection<E>containsAll in interface List<E>public E get(int index)
public boolean isEmpty()
public int lastIndexOf(Object o)
lastIndexOf in interface List<E>public ListIterator<E> listIterator()
listIterator in interface List<E>public ListIterator<E> listIterator(int index)
listIterator in interface List<E>public boolean remove(Object o)
public boolean removeAll(Collection<?> c)
public boolean retainAll(Collection<?> c)
public int size()
public Object[] toArray()
public <T> T[] toArray(T[] a)