org.apache.commons.collections4.list

## Class AbstractListDecorator<E>

- java.lang.Object
- - org.apache.commons.collections4.collection.AbstractCollectionDecorator<E>
  - - org.apache.commons.collections4.list.AbstractListDecorator<E>

- Type Parameters:
    `E` - the type of the elements in the list
  All Implemented Interfaces:
    Serializable, Iterable<E>, Collection<E>, List<E>
  Direct Known Subclasses:
    AbstractSerializableListDecorator

      public abstract class AbstractListDecorator<E>
      extends AbstractCollectionDecorator<E>
      implements List<E>

  Decorates another `List` to provide additional behaviour.

  Methods are forwarded directly to the decorated list.

  Since:
    3.0
  Version:
    $Id: AbstractListDecorator.java 1686855 2015-06-22 13:00:27Z tn $
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `AbstractListDecorator()` Constructor only used in deserialization, do not use otherwise.
    `protected` | `AbstractListDecorator(List<E> list)` Constructor that wraps (not copies).

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `add(int index, E object)`
    `boolean` | `addAll(int index, Collection<? extends E> coll)`
    `protected List<E>` | `decorated()` Gets the list being decorated.
    `boolean` | `equals(Object object)`
    `E` | `get(int index)`
    `int` | `hashCode()`
    `int` | `indexOf(Object object)`
    `int` | `lastIndexOf(Object object)`
    `ListIterator<E>` | `listIterator()`
    `ListIterator<E>` | `listIterator(int index)`
    `E` | `remove(int index)`
    `E` | `set(int index, E object)`
    `List<E>` | `subList(int fromIndex, int toIndex)`

    - ### Methods inherited from class org.apache.commons.collections4.collection.AbstractCollectionDecorator

      `add, addAll, clear, contains, containsAll, isEmpty, iterator, remove, removeAll, retainAll, setCollection, size, toArray, toArray, toString`

    - ### Methods inherited from class java.lang.Object

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

    - ### Methods inherited from interface java.util.List

      `add, addAll, clear, contains, containsAll, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray`

- - ### Constructor Detail

    - #### AbstractListDecorator

          protected AbstractListDecorator()

      Constructor only used in deserialization, do not use otherwise.
      Since:
        3.1

    - #### AbstractListDecorator

          protected AbstractListDecorator(List<E> list)

      Constructor that wraps (not copies).
      Parameters:
        `list` - the list to decorate, must not be null
      Throws:
        `NullPointerException` - if list is null

  - ### Method Detail

    - #### decorated

          protected List<E> decorated()

      Gets the list being decorated.
      Overrides:
        `decorated` in class `AbstractCollectionDecorator<E>`
      Returns:
        the decorated list

    - #### equals

          public boolean equals(Object object)

      Specified by:
        `equals` in interface `Collection<E>`
      Specified by:
        `equals` in interface `List<E>`
      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Specified by:
        `hashCode` in interface `Collection<E>`
      Specified by:
        `hashCode` in interface `List<E>`
      Overrides:
        `hashCode` in class `Object`

    - #### add

          public void add(int index,
                 E object)

      Specified by:
        `add` in interface `List<E>`

    - #### addAll

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

      Specified by:
        `addAll` in interface `List<E>`

    - #### get

          public E get(int index)

      Specified by:
        `get` in interface `List<E>`

    - #### indexOf

          public int indexOf(Object object)

      Specified by:
        `indexOf` in interface `List<E>`

    - #### lastIndexOf

          public int lastIndexOf(Object object)

      Specified by:
        `lastIndexOf` in interface `List<E>`

    - #### listIterator

          public ListIterator<E> listIterator()

      Specified by:
        `listIterator` in interface `List<E>`

    - #### listIterator

          public ListIterator<E> listIterator(int index)

      Specified by:
        `listIterator` in interface `List<E>`

    - #### remove

          public E remove(int index)

      Specified by:
        `remove` in interface `List<E>`

    - #### set

          public E set(int index,
              E object)

      Specified by:
        `set` in interface `List<E>`

    - #### subList

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

      Specified by:
        `subList` in interface `List<E>`

Copyright © 2001–2015 The Apache Software Foundation. All rights reserved.