Package: groovy.swing.impl

## [Java] Class ListWrapperListModel<E>

- groovy.swing.impl.ListWrapperListModel

-     public class ListWrapperListModel<E>
      extends AbstractListModel

  A `ListModel` implementation that's backed by a live `List`.

- - ### Constructor Summary

    Constructors
    Constructor and description
    `ListWrapperListModel(List<E> delegateList)` Creates a list model backed by the supplied live list.

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public void` | `add(int i, E e)` Inserts an element at the supplied index and notifies listeners.
    `` | `public boolean` | `add(E e)` Appends the supplied element to the backing list and notifies listeners.
    `` | `public boolean` | `addAll(Collection<? extends E> es)` Appends every element from the supplied collection and notifies listeners when anything was added.
    `` | `public boolean` | `addAll(int i, Collection<? extends E> es)` Inserts every element from the supplied collection at the supplied index.
    `` | `public void` | `clear()` Removes every element from the backing list and notifies listeners.
    `` | `public boolean` | `contains(Object o)` Returns whether the backing list contains the supplied element.
    `` | `public boolean` | `containsAll(Collection<?> objects)` Returns whether the backing list contains every supplied element.
    `` | `public E` | `get(int i)` Returns the element at the supplied index.
    `` | `public List<E>` | `getDelegateList()` Returns the live backing list.
    `` | `public Object` | `getElementAt(int i)` Returns the element at the supplied index from the backing list.
    `` | `public int` | `getSize()` Returns the number of elements currently exposed by the backing list.
    `` | `public int` | `indexOf(Object o)` Returns the first index of the supplied element in the backing list.
    `` | `public boolean` | `isEmpty()` Returns whether the backing list is empty.
    `` | `public Iterator<E>` | `iterator()` Returns an iterator over the backing list.
    `` | `public int` | `lastIndexOf(Object o)` Returns the last index of the supplied element in the backing list.
    `` | `public ListIterator<E>` | `listIterator()` Returns a list iterator over the backing list.
    `` | `public ListIterator<E>` | `listIterator(int i)` Returns a list iterator that starts at the supplied index.
    `` | `public E` | `remove(int i)` Removes the element at the supplied index and notifies listeners.
    `` | `public boolean` | `remove(Object o)` Removes the supplied element from the backing list and notifies listeners when it was present.
    `` | `public void` | `removeRange(int fromIndex, int toIndex)` Removes the inclusive index range from the backing list and notifies listeners.
    `` | `public E` | `set(int i, E e)` Replaces the element at the supplied index and fires a content-changed event.
    `<T>` | `public T[]` | `toArray(T[] ts)` Copies the backing list into the supplied destination array.
    `` | `public Object[]` | `toArray()` Copies the backing list into a new object array.

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class AbstractListModel` | `addListDataListener, equals, getClass, getElementAt, getListDataListeners, getListeners, getSize, hashCode, notify, notifyAll, removeListDataListener, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### public ListWrapperListModel(List<E> delegateList)

      Creates a list model backed by the supplied live list.

      Parameters:
        `delegateList` - the backing list

  - ### Method Detail

    - #### public void add(int i, E e)

      Inserts an element at the supplied index and notifies listeners.

      Parameters:
        `i` - the insertion index
        `e` - the element to insert

    - #### public boolean add(E e)

      Appends the supplied element to the backing list and notifies listeners.

      Parameters:
        `e` - the element to append
      Returns:
        `true` when the backing list changed

    - #### public boolean addAll(Collection<? extends E> es)

      Appends every element from the supplied collection and notifies listeners when anything was added.

      Parameters:
        `es` - the elements to append
      Returns:
        `true` when the backing list changed

    - #### public boolean addAll(int i, Collection<? extends E> es)

      Inserts every element from the supplied collection at the supplied index.

      Parameters:
        `i` - the insertion index
        `es` - the elements to insert
      Returns:
        `true` when the backing list changed

    - #### public void clear()

      Removes every element from the backing list and notifies listeners.

    - #### public boolean contains(Object o)

      Returns whether the backing list contains the supplied element.

      Parameters:
        `o` - the element to search for
      Returns:
        `true` when the element is present

    - #### public boolean containsAll(Collection<?> objects)

      Returns whether the backing list contains every supplied element.

      Parameters:
        `objects` - the elements to test
      Returns:
        `true` when every element is present

    - #### public E get(int i)

      Returns the element at the supplied index.

      Parameters:
        `i` - the element index
      Returns:
        the element at that index

    - #### public List<E> getDelegateList()

      Returns the live backing list.

      Returns:
        the delegate list

    - #### public Object getElementAt(int i)

      Returns the element at the supplied index from the backing list.

      Parameters:
        `i` - the requested element index
      Returns:
        the element at `i`

    - #### public int getSize()

      Returns the number of elements currently exposed by the backing list.

      Returns:
        the current model size

    - #### public int indexOf(Object o)

      Returns the first index of the supplied element in the backing list.

      Parameters:
        `o` - the element to search for
      Returns:
        the first matching index, or `-1`

    - #### public boolean isEmpty()

      Returns whether the backing list is empty.

      Returns:
        `true` when the model contains no elements

    - #### public Iterator<E> iterator()

      Returns an iterator over the backing list.

      Returns:
        an iterator over the current contents

    - #### public int lastIndexOf(Object o)

      Returns the last index of the supplied element in the backing list.

      Parameters:
        `o` - the element to search for
      Returns:
        the last matching index, or `-1`

    - #### public ListIterator<E> listIterator()

      Returns a list iterator over the backing list.

      Returns:
        a list iterator over the current contents

    - #### public ListIterator<E> listIterator(int i)

      Returns a list iterator that starts at the supplied index.

      Parameters:
        `i` - the starting index
      Returns:
        a list iterator positioned at the supplied index

    - #### public E remove(int i)

      Removes the element at the supplied index and notifies listeners.

      Parameters:
        `i` - the element index
      Returns:
        the removed element

    - #### public boolean remove(Object o)

      Removes the supplied element from the backing list and notifies listeners when it was present.

      Parameters:
        `o` - the element to remove
      Returns:
        `true` when the backing list changed

    - #### public void removeRange(int fromIndex, int toIndex)

      Removes the inclusive index range from the backing list and notifies listeners.

      Parameters:
        `fromIndex` - the first index to remove
        `toIndex` - the last index to remove

    - #### public E set(int i, E e)

      Replaces the element at the supplied index and fires a content-changed event.

      Parameters:
        `i` - the element index
        `e` - the replacement element
      Returns:
        the previous element

    - #### <T> public T[] toArray(T[] ts)

      Copies the backing list into the supplied destination array.

      Parameters:
        `ts` - the destination array
      Type Parameters:
        `T` - the array component type
      Returns:
        the populated array

    - #### public Object[] toArray()

      Copies the backing list into a new object array.

      Returns:
        an array containing the current contents