Class ForwardingList<E>

  • All Implemented Interfaces:
    Iterable<E>, Collection<E>, List<E>
    Direct Known Subclasses:
    EnumerationList

    public abstract class ForwardingList<E>
    extends Object
    implements List<E>
    A list which forwards all its method calls to another list. Subclasses should override one or more methods to modify the behavior of the backing list as desired per the decorator pattern.

    This class does not implement RandomAccess. If the delegate supports random access, the ForwardingList subclass should implement the RandomAccess interface.

    Since:
    2 (imported from Google Collections Library)
    Author:
    Mike Bostock
    • Constructor Detail

      • ForwardingList

        protected ForwardingList()
        Constructor for use by subclasses.
    • Method Detail

      • delegate

        protected abstract List<E> delegate()
      • add

        public void add​(int index,
                        E element)
      • addAll

        public boolean addAll​(int index,
                              Collection<? extends E> elements)
      • get

        public E get​(int index)
      • indexOf

        public int indexOf​(Object element)
      • lastIndexOf

        public int lastIndexOf​(Object element)
      • listIterator

        public ListIterator<E> listIterator​(int index)
      • remove

        public E remove​(int index)
      • set

        public E set​(int index,
                     E element)
      • subList

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

        public boolean equals​(Object object)
      • hashCode

        public int hashCode()
      • size

        public int size()
      • removeAll

        public boolean removeAll​(Collection<?> collection)
      • isEmpty

        public boolean isEmpty()
      • contains

        public boolean contains​(Object object)
      • toArray

        public Object[] toArray()
      • toArray

        public <T> T[] toArray​(T[] array)
      • add

        public boolean add​(E element)
      • remove

        public boolean remove​(Object object)
      • containsAll

        public boolean containsAll​(Collection<?> collection)
      • addAll

        public boolean addAll​(Collection<? extends E> collection)
      • retainAll

        public boolean retainAll​(Collection<?> collection)
      • clear

        public void clear()