org.springframework.util

## 类 AutoPopulatingList<E>

- java.lang.Object
- - org.springframework.util.AutoPopulatingList<E>

- 所有已实现的接口:
    Serializable, Iterable<E>, Collection<E>, List<E>

      public class AutoPopulatingList<E>
      extends Object
      implements List<E>, Serializable

  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<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 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)`

    - ### 从类继承的方法 java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

    - ### 从接口继承的方法 java.util.List

      `replaceAll, sort, spliterator`

    - ### 从接口继承的方法 java.util.Collection

      `parallelStream, removeIf, stream`

    - ### 从接口继承的方法 java.lang.Iterable

      `forEach`

- - ### 构造器详细资料

    - #### AutoPopulatingList

          public 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

          public 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.

    - #### AutoPopulatingList

          public 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

          public 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`.

  - ### 方法详细资料

    - #### add

          public void add(int index,
                          E element)

      指定者:
        `add` 在接口中 `List<E>`

    - #### add

          public boolean add(E o)

      指定者:
        `add` 在接口中 `Collection<E>`
      指定者:
        `add` 在接口中 `List<E>`

    - #### addAll

          public boolean addAll(Collection<? extends E> c)

      指定者:
        `addAll` 在接口中 `Collection<E>`
      指定者:
        `addAll` 在接口中 `List<E>`

    - #### addAll

          public boolean addAll(int index,
                                Collection<? extends E> c)

      指定者:
        `addAll` 在接口中 `List<E>`

    - #### clear

          public void clear()

      指定者:
        `clear` 在接口中 `Collection<E>`
      指定者:
        `clear` 在接口中 `List<E>`

    - #### contains

          public boolean contains(Object o)

      指定者:
        `contains` 在接口中 `Collection<E>`
      指定者:
        `contains` 在接口中 `List<E>`

    - #### 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.
      指定者:
        `get` 在接口中 `List<E>`

    - #### indexOf

          public int indexOf(Object o)

      指定者:
        `indexOf` 在接口中 `List<E>`

    - #### isEmpty

          public boolean isEmpty()

      指定者:
        `isEmpty` 在接口中 `Collection<E>`
      指定者:
        `isEmpty` 在接口中 `List<E>`

    - #### iterator

          public Iterator<E> iterator()

      指定者:
        `iterator` 在接口中 `Iterable<E>`
      指定者:
        `iterator` 在接口中 `Collection<E>`
      指定者:
        `iterator` 在接口中 `List<E>`

    - #### 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>`

    - #### remove

          public E remove(int index)

      指定者:
        `remove` 在接口中 `List<E>`

    - #### remove

          public boolean remove(Object o)

      指定者:
        `remove` 在接口中 `Collection<E>`
      指定者:
        `remove` 在接口中 `List<E>`

    - #### removeAll

          public boolean removeAll(Collection<?> c)

      指定者:
        `removeAll` 在接口中 `Collection<E>`
      指定者:
        `removeAll` 在接口中 `List<E>`

    - #### retainAll

          public boolean retainAll(Collection<?> c)

      指定者:
        `retainAll` 在接口中 `Collection<E>`
      指定者:
        `retainAll` 在接口中 `List<E>`

    - #### set

          public E set(int index,
                       E element)

      指定者:
        `set` 在接口中 `List<E>`

    - #### size

          public int size()

      指定者:
        `size` 在接口中 `Collection<E>`
      指定者:
        `size` 在接口中 `List<E>`

    - #### subList

          public List<E> subList(int fromIndex,
                                 int toIndex)

      指定者:
        `subList` 在接口中 `List<E>`

    - #### toArray

          public Object[] toArray()

      指定者:
        `toArray` 在接口中 `Collection<E>`
      指定者:
        `toArray` 在接口中 `List<E>`

    - #### toArray

          public <T> T[] toArray(T[] a)

      指定者:
        `toArray` 在接口中 `Collection<E>`
      指定者:
        `toArray` 在接口中 `List<E>`

    - #### equals

          public boolean equals(Object other)

      指定者:
        `equals` 在接口中 `Collection<E>`
      指定者:
        `equals` 在接口中 `List<E>`
      覆盖:
        `equals` 在类中 `Object`

    - #### hashCode

          public int hashCode()

      指定者:
        `hashCode` 在接口中 `Collection<E>`
      指定者:
        `hashCode` 在接口中 `List<E>`
      覆盖:
        `hashCode` 在类中 `Object`