public class AutoPopulatingList<E> extends Object implements List<E>, Serializable
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<T>) utility methods.
Inspired by LazyList from Commons Collections.
| 限定符和类型 | 类和说明 |
|---|---|
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.
|
| 构造器和说明 |
|---|
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. |
| 限定符和类型 | 方法和说明 |
|---|---|
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() |
<T> T[] |
toArray(T[] a) |
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.public boolean addAll(Collection<? extends E> c)
public boolean addAll(int index,
Collection<? extends E> c)
public boolean contains(Object o)
public boolean containsAll(Collection c)
containsAll 在接口中 Collection<E>containsAll 在接口中 List<E>public E get(int index)
public int lastIndexOf(Object o)
lastIndexOf 在接口中 List<E>public ListIterator<E> listIterator()
listIterator 在接口中 List<E>public ListIterator<E> listIterator(int index)
listIterator 在接口中 List<E>public boolean removeAll(Collection<?> c)
public boolean retainAll(Collection<?> c)
public boolean equals(Object other)
Copyright © 2013 The Skfiy Open Association. All Rights Reserved.