|
||||||||||
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(java.lang.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(java.util.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(java.util.List backingList,
java.lang.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,
java.lang.Object element)
|
boolean |
add(java.lang.Object o)
|
boolean |
addAll(java.util.Collection c)
|
boolean |
addAll(int index,
java.util.Collection c)
|
void |
clear()
|
boolean |
contains(java.lang.Object o)
|
boolean |
containsAll(java.util.Collection c)
|
boolean |
equals(java.lang.Object o)
|
java.lang.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(java.lang.Object o)
|
boolean |
isEmpty()
|
java.util.Iterator |
iterator()
|
int |
lastIndexOf(java.lang.Object o)
|
java.util.ListIterator |
listIterator()
|
java.util.ListIterator |
listIterator(int index)
|
java.lang.Object |
remove(int index)
|
boolean |
remove(java.lang.Object o)
|
boolean |
removeAll(java.util.Collection c)
|
boolean |
retainAll(java.util.Collection c)
|
java.lang.Object |
set(int index,
java.lang.Object element)
|
int |
size()
|
java.util.List |
subList(int fromIndex,
int toIndex)
|
java.lang.Object[] |
toArray()
|
java.lang.Object[] |
toArray(java.lang.Object[] a)
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AutoPopulatingList(java.lang.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(java.util.List backingList, java.lang.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(java.util.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, java.lang.Object element)
add
in interface java.util.List
public boolean add(java.lang.Object o)
add
in interface java.util.Collection
add
in interface java.util.List
public boolean addAll(java.util.Collection c)
addAll
in interface java.util.Collection
addAll
in interface java.util.List
public boolean addAll(int index, java.util.Collection c)
addAll
in interface java.util.List
public void clear()
clear
in interface java.util.Collection
clear
in interface java.util.List
public boolean contains(java.lang.Object o)
contains
in interface java.util.Collection
contains
in interface java.util.List
public boolean containsAll(java.util.Collection c)
containsAll
in interface java.util.Collection
containsAll
in interface java.util.List
public boolean equals(java.lang.Object o)
equals
in interface java.util.Collection
equals
in interface java.util.List
equals
in class java.lang.Object
public java.lang.Object get(int index)
get
in interface java.util.List
public int hashCode()
hashCode
in interface java.util.Collection
hashCode
in interface java.util.List
hashCode
in class java.lang.Object
public int indexOf(java.lang.Object o)
indexOf
in interface java.util.List
public boolean isEmpty()
isEmpty
in interface java.util.Collection
isEmpty
in interface java.util.List
public java.util.Iterator iterator()
iterator
in interface java.lang.Iterable
iterator
in interface java.util.Collection
iterator
in interface java.util.List
public int lastIndexOf(java.lang.Object o)
lastIndexOf
in interface java.util.List
public java.util.ListIterator listIterator()
listIterator
in interface java.util.List
public java.util.ListIterator listIterator(int index)
listIterator
in interface java.util.List
public java.lang.Object remove(int index)
remove
in interface java.util.List
public boolean remove(java.lang.Object o)
remove
in interface java.util.Collection
remove
in interface java.util.List
public boolean removeAll(java.util.Collection c)
removeAll
in interface java.util.Collection
removeAll
in interface java.util.List
public boolean retainAll(java.util.Collection c)
retainAll
in interface java.util.Collection
retainAll
in interface java.util.List
public java.lang.Object set(int index, java.lang.Object element)
set
in interface java.util.List
public int size()
size
in interface java.util.Collection
size
in interface java.util.List
public java.util.List subList(int fromIndex, int toIndex)
subList
in interface java.util.List
public java.lang.Object[] toArray()
toArray
in interface java.util.Collection
toArray
in interface java.util.List
public java.lang.Object[] toArray(java.lang.Object[] a)
toArray
in interface java.util.Collection
toArray
in interface java.util.List
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |