Class S2ShapeIndex.SimpleList<T>

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Iterable<T>, java.util.Collection<T>, java.util.List<T>, java.util.RandomAccess
    Enclosing class:
    S2ShapeIndex

    private static final class S2ShapeIndex.SimpleList<T>
    extends java.util.AbstractList<T>
    implements java.util.RandomAccess, java.io.Serializable
    A simple append-only RandomAccess List similar to (but about 10% faster than) ArrayList.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.lang.Object[] elements  
      private static long serialVersionUID  
      private int size  
      • Fields inherited from class java.util.AbstractList

        modCount
    • Constructor Summary

      Constructors 
      Constructor Description
      SimpleList​(int maxSize)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean add​(T item)  
      T get​(int index)  
      T set​(int index, T value)  
      int size()  
      • Methods inherited from class java.util.AbstractList

        add, addAll, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, removeRange, subList
      • 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

      • elements

        private java.lang.Object[] elements
      • size

        private int size
    • Constructor Detail

      • SimpleList

        public SimpleList​(int maxSize)
    • Method Detail

      • get

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

        public T set​(int index,
                     T value)
        Specified by:
        set in interface java.util.List<T>
        Overrides:
        set 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>
      • add

        public boolean add​(T item)
        Specified by:
        add in interface java.util.Collection<T>
        Specified by:
        add in interface java.util.List<T>
        Overrides:
        add in class java.util.AbstractList<T>