类 AutoPopulatingList<E>
- java.lang.Object
- org.springframework.util.AutoPopulatingList<E>
- 类型参数:
E
- the element type
- 所有已实现的接口:
Serializable
,Iterable<E>
,Collection<E>
,List<E>
public class AutoPopulatingList<E> extends Object implements List<E>, Serializable
SimpleList
wrapper class that allows for elements to be automatically populated as they are requested. This is particularly useful for data binding toLists
, allowing for elements to be created and added to theList
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.- 从以下版本开始:
- 2.0
- 作者:
- Rob Harrop, Juergen Hoeller
- 另请参阅:
- 序列化表格
嵌套类概要
嵌套类 修饰符和类型 类 说明 static interface
AutoPopulatingList.ElementFactory<E>
Factory interface for creating elements for an index-based access data structure such as aList
.static class
AutoPopulatingList.ElementInstantiationException
Exception to be thrown from ElementFactory.
构造器概要
构造器 构造器 说明 AutoPopulatingList(Class<? extends E> elementClass)
Creates a newAutoPopulatingList
that is backed by a standardArrayList
and adds new instances of the suppliedelement Class
to the backingList
on demand.AutoPopulatingList(List<E> backingList, Class<? extends E> elementClass)
Creates a newAutoPopulatingList
that is backed by the suppliedList
and adds new instances of the suppliedelement Class
to the backingList
on demand.AutoPopulatingList(List<E> backingList, AutoPopulatingList.ElementFactory<E> elementFactory)
Creates a newAutoPopulatingList
that is backed by the suppliedList
and creates new elements on demand using the suppliedAutoPopulatingList.ElementFactory
.AutoPopulatingList(AutoPopulatingList.ElementFactory<E> elementFactory)
Creates a newAutoPopulatingList
that is backed by a standardArrayList
and creates new elements on demand using the suppliedAutoPopulatingList.ElementFactory
.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 void
add(int index, E element)
boolean
add(E o)
boolean
addAll(int index, Collection<? extends E> c)
boolean
addAll(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)
从接口继承的方法 java.util.Collection
parallelStream, removeIf, stream, toArray
从接口继承的方法 java.util.List
replaceAll, sort, spliterator
构造器详细资料
AutoPopulatingList
public AutoPopulatingList(Class<? extends E> elementClass)
Creates a newAutoPopulatingList
that is backed by a standardArrayList
and adds new instances of the suppliedelement Class
to the backingList
on demand.
AutoPopulatingList
public AutoPopulatingList(List<E> backingList, Class<? extends E> elementClass)
Creates a newAutoPopulatingList
that is backed by the suppliedList
and adds new instances of the suppliedelement Class
to the backingList
on demand.
AutoPopulatingList
public AutoPopulatingList(AutoPopulatingList.ElementFactory<E> elementFactory)
Creates a newAutoPopulatingList
that is backed by a standardArrayList
and creates new elements on demand using the suppliedAutoPopulatingList.ElementFactory
.
AutoPopulatingList
public AutoPopulatingList(List<E> backingList, AutoPopulatingList.ElementFactory<E> elementFactory)
Creates a newAutoPopulatingList
that is backed by the suppliedList
and creates new elements on demand using the suppliedAutoPopulatingList.ElementFactory
.
方法详细资料
addAll
public boolean addAll(Collection<? extends E> c)
containsAll
public boolean containsAll(Collection<?> c)
- 指定者:
containsAll
在接口中Collection<E>
- 指定者:
containsAll
在接口中List<E>
get
public E get(int index)
Get the element at the supplied index, creating it if there is no element at that index.
lastIndexOf
public int lastIndexOf(Object o)
- 指定者:
lastIndexOf
在接口中List<E>
listIterator
public ListIterator<E> listIterator()
- 指定者:
listIterator
在接口中List<E>
listIterator
public ListIterator<E> listIterator(int index)
- 指定者:
listIterator
在接口中List<E>
removeAll
public boolean removeAll(Collection<?> c)
retainAll
public boolean retainAll(Collection<?> c)