java.lang.Object | |
↳ | org.springframework.util.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 synchronizedList(List
utility methods.
Inspired by LazyList
from Commons Collections.
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
AutoPopulatingList.ElementFactory<E> | Factory interface for creating elements for an index-based access data structure such as a java.util.List. | ||||||||||
AutoPopulatingList.ElementInstantiationException | Exception to be thrown from ElementFactory. |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
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. | |||||||||||
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. | |||||||||||
Creates a new
AutoPopulatingList that is backed by a standard
ArrayList and creates new elements on demand using the supplied AutoPopulatingList.ElementFactory . | |||||||||||
Creates a new
AutoPopulatingList that is backed by the supplied List
and creates new elements on demand using the supplied AutoPopulatingList.ElementFactory . |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Get the element at the supplied index, creating it if there is
no element at that index.
| |||||||||||
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
| |||||||||||
From interface
java.lang.Iterable
| |||||||||||
From interface
java.util.Collection
| |||||||||||
From interface
java.util.List
|
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.
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.
Creates a new AutoPopulatingList
that is backed by a standard
ArrayList and creates new elements on demand using the supplied AutoPopulatingList.ElementFactory
.
Creates a new AutoPopulatingList
that is backed by the supplied List
and creates new elements on demand using the supplied AutoPopulatingList.ElementFactory
.
Get the element at the supplied index, creating it if there is no element at that index.