Class ListDecorator<E>

java.lang.Object
com.globalmentor.collections.CollectionDecorator<E>
com.globalmentor.collections.ListDecorator<E>
Type Parameters:
E - The type of element contained in the list.
All Implemented Interfaces:
Iterable<E>, Collection<E>, List<E>
Direct Known Subclasses:
AbstractConverterList, DecoratorIDedMappedList

public class ListDecorator<E> extends CollectionDecorator<E> implements List<E>
A list that wraps an existing list, providing access through the List interface.
Author:
Garret Wilson
  • Field Details

    • list

      protected final List<E> list
      The list this class decorates.
  • Constructor Details

    • ListDecorator

      public ListDecorator(List<E> list)
      List constructor.
      Parameters:
      list - The list this list should decorate.
      Throws:
      NullPointerException - if the provided list is null.
  • Method Details

    • addAll

      public boolean addAll(int index, Collection<? extends E> c)
      Specified by:
      addAll in interface List<E>
    • get

      public E get(int index)
      Specified by:
      get in interface List<E>
    • set

      public E set(int index, E element)
      Specified by:
      set in interface List<E>
    • add

      public void add(int index, E element)
      Specified by:
      add in interface List<E>
    • remove

      public E remove(int index)
      Specified by:
      remove in interface List<E>
    • indexOf

      public int indexOf(Object o)
      Specified by:
      indexOf in interface List<E>
    • lastIndexOf

      public int lastIndexOf(Object o)
      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>
    • subList

      public List<E> subList(int fromIndex, int toIndex)
      Specified by:
      subList in interface List<E>
    • replaceAll

      public void replaceAll(UnaryOperator<E> operator)
      Specified by:
      replaceAll in interface List<E>
    • sort

      public void sort(Comparator<? super E> c)
      Specified by:
      sort in interface List<E>