|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.springframework.util.AutoPopulatingList
public class AutoPopulatingList
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
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 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 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 backingList,
AutoPopulatingList.ElementFactory 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 backingList,
Class 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 | |
|---|---|
void |
add(int index,
Object element)
|
boolean |
add(Object o)
|
boolean |
addAll(Collection c)
|
boolean |
addAll(int index,
Collection c)
|
void |
clear()
|
boolean |
contains(Object o)
|
boolean |
containsAll(Collection c)
|
boolean |
equals(Object o)
|
Object |
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 |
iterator()
|
int |
lastIndexOf(Object o)
|
ListIterator |
listIterator()
|
ListIterator |
listIterator(int index)
|
Object |
remove(int index)
|
boolean |
remove(Object o)
|
boolean |
removeAll(Collection c)
|
boolean |
retainAll(Collection c)
|
Object |
set(int index,
Object element)
|
int |
size()
|
List |
subList(int fromIndex,
int toIndex)
|
Object[] |
toArray()
|
Object[] |
toArray(Object[] a)
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public AutoPopulatingList(Class 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 backingList,
Class 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 elementFactory)
AutoPopulatingList that is backed by a standard
ArrayList and creates new elements on demand using the supplied AutoPopulatingList.ElementFactory.
public AutoPopulatingList(List backingList,
AutoPopulatingList.ElementFactory 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,
Object element)
add in interface Listpublic boolean add(Object o)
add in interface Collectionadd in interface Listpublic boolean addAll(Collection c)
addAll in interface CollectionaddAll in interface List
public boolean addAll(int index,
Collection c)
addAll in interface Listpublic void clear()
clear in interface Collectionclear in interface Listpublic boolean contains(Object o)
contains in interface Collectioncontains in interface Listpublic boolean containsAll(Collection c)
containsAll in interface CollectioncontainsAll in interface Listpublic boolean equals(Object o)
equals in interface Collectionequals in interface Listequals in class Objectpublic Object get(int index)
get in interface Listpublic int hashCode()
hashCode in interface CollectionhashCode in interface ListhashCode in class Objectpublic int indexOf(Object o)
indexOf in interface Listpublic boolean isEmpty()
isEmpty in interface CollectionisEmpty in interface Listpublic Iterator iterator()
iterator in interface Iterableiterator in interface Collectioniterator in interface Listpublic int lastIndexOf(Object o)
lastIndexOf in interface Listpublic ListIterator listIterator()
listIterator in interface Listpublic ListIterator listIterator(int index)
listIterator in interface Listpublic Object remove(int index)
remove in interface Listpublic boolean remove(Object o)
remove in interface Collectionremove in interface Listpublic boolean removeAll(Collection c)
removeAll in interface CollectionremoveAll in interface Listpublic boolean retainAll(Collection c)
retainAll in interface CollectionretainAll in interface List
public Object set(int index,
Object element)
set in interface Listpublic int size()
size in interface Collectionsize in interface List
public List subList(int fromIndex,
int toIndex)
subList in interface Listpublic Object[] toArray()
toArray in interface CollectiontoArray in interface Listpublic Object[] toArray(Object[] a)
toArray in interface CollectiontoArray in interface List
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||