Class Lists.ReverseList<T>

  • All Implemented Interfaces:
    java.lang.Iterable<T>, java.util.Collection<T>, java.util.List<T>
    Direct Known Subclasses:
    Lists.RandomAccessReverseList
    Enclosing class:
    Lists

    private static class Lists.ReverseList<T>
    extends java.util.AbstractList<T>
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.List<T> forwardList  
      • Fields inherited from class java.util.AbstractList

        modCount
    • Constructor Summary

      Constructors 
      Constructor Description
      ReverseList​(java.util.List<T> forwardList)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(int index, T element)  
      void clear()  
      T get​(int index)  
      (package private) java.util.List<T> getForwardList()  
      java.util.Iterator<T> iterator()  
      java.util.ListIterator<T> listIterator​(int index)  
      T remove​(int index)  
      protected void removeRange​(int fromIndex, int toIndex)  
      private int reverseIndex​(int index)  
      private int reversePosition​(int index)  
      T set​(int index, T element)  
      int size()  
      java.util.List<T> subList​(int fromIndex, int toIndex)  
      • Methods inherited from class java.util.AbstractList

        add, addAll, equals, hashCode, indexOf, lastIndexOf, listIterator
      • Methods inherited from class java.util.AbstractCollection

        addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.util.Collection

        parallelStream, removeIf, stream, toArray
      • Methods inherited from interface java.lang.Iterable

        forEach
      • Methods inherited from interface java.util.List

        addAll, contains, containsAll, isEmpty, remove, removeAll, replaceAll, retainAll, sort, spliterator, toArray, toArray
    • Field Detail

      • forwardList

        private final java.util.List<T> forwardList
    • Constructor Detail

      • ReverseList

        ReverseList​(java.util.List<T> forwardList)
    • Method Detail

      • getForwardList

        java.util.List<T> getForwardList()
      • reverseIndex

        private int reverseIndex​(int index)
      • reversePosition

        private int reversePosition​(int index)
      • add

        public void add​(int index,
                        T element)
        Specified by:
        add in interface java.util.List<T>
        Overrides:
        add in class java.util.AbstractList<T>
      • clear

        public void clear()
        Specified by:
        clear in interface java.util.Collection<T>
        Specified by:
        clear in interface java.util.List<T>
        Overrides:
        clear in class java.util.AbstractList<T>
      • remove

        public T remove​(int index)
        Specified by:
        remove in interface java.util.List<T>
        Overrides:
        remove in class java.util.AbstractList<T>
      • removeRange

        protected void removeRange​(int fromIndex,
                                   int toIndex)
        Overrides:
        removeRange in class java.util.AbstractList<T>
      • set

        public T set​(int index,
                     T element)
        Specified by:
        set in interface java.util.List<T>
        Overrides:
        set in class java.util.AbstractList<T>
      • get

        public T get​(int index)
        Specified by:
        get in interface java.util.List<T>
        Specified by:
        get in class java.util.AbstractList<T>
      • size

        public int size()
        Specified by:
        size in interface java.util.Collection<T>
        Specified by:
        size in interface java.util.List<T>
        Specified by:
        size in class java.util.AbstractCollection<T>
      • subList

        public java.util.List<T> subList​(int fromIndex,
                                         int toIndex)
        Specified by:
        subList in interface java.util.List<T>
        Overrides:
        subList in class java.util.AbstractList<T>
      • iterator

        public java.util.Iterator<T> iterator()
        Specified by:
        iterator in interface java.util.Collection<T>
        Specified by:
        iterator in interface java.lang.Iterable<T>
        Specified by:
        iterator in interface java.util.List<T>
        Overrides:
        iterator in class java.util.AbstractList<T>
      • listIterator

        public java.util.ListIterator<T> listIterator​(int index)
        Specified by:
        listIterator in interface java.util.List<T>
        Overrides:
        listIterator in class java.util.AbstractList<T>