|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.springframework.util.AutoPopulatingList<E>
public class AutoPopulatingList<E>
Simple 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 utility methods.
Inspired by LazyList from Commons Collections.
| Nested Class Summary | |
|---|---|
static interface |
AutoPopulatingList.ElementFactory<E>
Factory interface for creating elements for an index-based access data structure such as a List. |
static class |
AutoPopulatingList.ElementInstantiationException
Exception to be thrown from ElementFactory. |
| Constructor Summary | |
|---|---|
AutoPopulatingList(AutoPopulatingList.ElementFactory<E> elementFactory)
Creates a new AutoPopulatingList that is backed by a standard
ArrayList and creates new elements on demand using the supplied AutoPopulatingList.ElementFactory. |
|
AutoPopulatingList(Class<? extends E> elementClass)
Creates a new AutoPopulatingList that is backed by a standard
ArrayList and adds new instances of the supplied element Class
to the backing List on demand. |
|
AutoPopulatingList(List<E> backingList,
AutoPopulatingList.ElementFactory<E> elementFactory)
Creates a new AutoPopulatingList that is backed by the supplied List
and creates new elements on demand using the supplied AutoPopulatingList.ElementFactory. |
|
AutoPopulatingList(List<E> backingList,
Class<? extends E> elementClass)
Creates a new AutoPopulatingList that is backed by the supplied List
and adds new instances of the supplied element Class to the backing
List on demand. |
|
| Method Summary | ||
|---|---|---|
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()
|
|
|
toArray(T[] a)
|
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public 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.
| Method Detail |
|---|
public void add(int index,
E element)
add in interface List<E>public boolean add(E o)
add in interface Collection<E>add in interface List<E>public boolean addAll(Collection<? extends E> c)
addAll in interface Collection<E>addAll in interface List<E>
public boolean addAll(int index,
Collection<? extends E> c)
addAll in interface List<E>public void clear()
clear in interface Collection<E>clear in interface List<E>public boolean contains(Object o)
contains in interface Collection<E>contains in interface List<E>public boolean containsAll(Collection c)
containsAll in interface Collection<E>containsAll in interface List<E>public E get(int index)
get in interface List<E>public int indexOf(Object o)
indexOf in interface List<E>public boolean isEmpty()
isEmpty in interface Collection<E>isEmpty in interface List<E>public Iterator<E> iterator()
iterator in interface Iterable<E>iterator in interface Collection<E>iterator in interface List<E>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 E remove(int index)
remove in interface List<E>public boolean remove(Object o)
remove in interface Collection<E>remove in interface List<E>public boolean removeAll(Collection<?> c)
removeAll in interface Collection<E>removeAll in interface List<E>public boolean retainAll(Collection<?> c)
retainAll in interface Collection<E>retainAll in interface List<E>
public E set(int index,
E element)
set in interface List<E>public int size()
size in interface Collection<E>size in interface List<E>
public List<E> subList(int fromIndex,
int toIndex)
subList in interface List<E>public Object[] toArray()
toArray in interface Collection<E>toArray in interface List<E>public <T> T[] toArray(T[] a)
toArray in interface Collection<E>toArray in interface List<E>public boolean equals(Object other)
equals in interface Collection<E>equals in interface List<E>equals in class Objectpublic int hashCode()
hashCode in interface Collection<E>hashCode in interface List<E>hashCode in class Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||