Class LongArrayList

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private long[] array
      The backing store for the list.
      private static long[] EMPTY_ARRAY  
      private static LongArrayList EMPTY_LIST  
      private int size
      The size of the list distinct from the length of the array.
      • Fields inherited from class java.util.AbstractList

        modCount
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      (package private) LongArrayList()
      Constructs a new mutable LongArrayList with default capacity.
      private LongArrayList​(long[] other, int size, boolean isMutable)
      Constructs a new mutable LongArrayList containing the same elements as other.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(int index, java.lang.Long element)  
      boolean add​(java.lang.Long element)  
      boolean addAll​(java.util.Collection<? extends java.lang.Long> collection)  
      private void addLong​(int index, long element)
      Like add(int, Long) but more efficient in that it doesn't box the element.
      void addLong​(long element)
      Like add(Long) but more efficient in that it doesn't box the element.
      boolean contains​(java.lang.Object element)  
      static LongArrayList emptyList()  
      (package private) void ensureCapacity​(int minCapacity)
      Ensures the backing array can fit at least minCapacity elements.
      private void ensureIndexInRange​(int index)
      Ensures that the provided index is within the range of [0, size].
      boolean equals​(java.lang.Object o)  
      java.lang.Long get​(int index)  
      long getLong​(int index)
      Like List.get(int) but more efficient in that it doesn't box the returned value.
      private static int growSize​(int previousSize)  
      int hashCode()  
      int indexOf​(java.lang.Object element)  
      private java.lang.String makeOutOfBoundsExceptionMessage​(int index)  
      Internal.LongList mutableCopyWithCapacity​(int capacity)
      Returns a mutable clone of this list with the specified capacity.
      java.lang.Long remove​(int index)  
      protected void removeRange​(int fromIndex, int toIndex)  
      java.lang.Long set​(int index, java.lang.Long element)  
      long setLong​(int index, long element)
      Like List.set(int, Object) but more efficient in that it doesn't box the element.
      int size()  
      • Methods inherited from class java.util.AbstractList

        iterator, lastIndexOf, listIterator, listIterator, subList
      • Methods inherited from class java.util.AbstractCollection

        containsAll, isEmpty, 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, clear, containsAll, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, removeAll, replaceAll, retainAll, sort, spliterator, subList, toArray, toArray
    • Field Detail

      • EMPTY_ARRAY

        private static final long[] EMPTY_ARRAY
      • array

        private long[] array
        The backing store for the list.
      • size

        private int size
        The size of the list distinct from the length of the array. That is, it is the number of elements set in the list.
    • Constructor Detail

      • LongArrayList

        LongArrayList()
        Constructs a new mutable LongArrayList with default capacity.
      • LongArrayList

        private LongArrayList​(long[] other,
                              int size,
                              boolean isMutable)
        Constructs a new mutable LongArrayList containing the same elements as other.
    • Method Detail

      • removeRange

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

        public boolean equals​(java.lang.Object o)
        Specified by:
        equals in interface java.util.Collection<java.lang.Long>
        Specified by:
        equals in interface java.util.List<java.lang.Long>
        Overrides:
        equals in class AbstractProtobufList<java.lang.Long>
      • hashCode

        public int hashCode()
        Specified by:
        hashCode in interface java.util.Collection<java.lang.Long>
        Specified by:
        hashCode in interface java.util.List<java.lang.Long>
        Overrides:
        hashCode in class AbstractProtobufList<java.lang.Long>
      • get

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

        public long getLong​(int index)
        Description copied from interface: Internal.LongList
        Like List.get(int) but more efficient in that it doesn't box the returned value.
        Specified by:
        getLong in interface Internal.LongList
      • indexOf

        public int indexOf​(java.lang.Object element)
        Specified by:
        indexOf in interface java.util.List<java.lang.Long>
        Overrides:
        indexOf in class java.util.AbstractList<java.lang.Long>
      • contains

        public boolean contains​(java.lang.Object element)
        Specified by:
        contains in interface java.util.Collection<java.lang.Long>
        Specified by:
        contains in interface java.util.List<java.lang.Long>
        Overrides:
        contains in class java.util.AbstractCollection<java.lang.Long>
      • size

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

        public java.lang.Long set​(int index,
                                  java.lang.Long element)
        Specified by:
        set in interface java.util.List<java.lang.Long>
        Overrides:
        set in class AbstractProtobufList<java.lang.Long>
      • setLong

        public long setLong​(int index,
                            long element)
        Description copied from interface: Internal.LongList
        Like List.set(int, Object) but more efficient in that it doesn't box the element.
        Specified by:
        setLong in interface Internal.LongList
      • add

        public boolean add​(java.lang.Long element)
        Specified by:
        add in interface java.util.Collection<java.lang.Long>
        Specified by:
        add in interface java.util.List<java.lang.Long>
        Overrides:
        add in class AbstractProtobufList<java.lang.Long>
      • add

        public void add​(int index,
                        java.lang.Long element)
        Specified by:
        add in interface java.util.List<java.lang.Long>
        Overrides:
        add in class AbstractProtobufList<java.lang.Long>
      • addLong

        public void addLong​(long element)
        Like add(Long) but more efficient in that it doesn't box the element.
        Specified by:
        addLong in interface Internal.LongList
      • addLong

        private void addLong​(int index,
                             long element)
        Like add(int, Long) but more efficient in that it doesn't box the element.
      • addAll

        public boolean addAll​(java.util.Collection<? extends java.lang.Long> collection)
        Specified by:
        addAll in interface java.util.Collection<java.lang.Long>
        Specified by:
        addAll in interface java.util.List<java.lang.Long>
        Overrides:
        addAll in class AbstractProtobufList<java.lang.Long>
      • remove

        public java.lang.Long remove​(int index)
        Specified by:
        remove in interface java.util.List<java.lang.Long>
        Overrides:
        remove in class AbstractProtobufList<java.lang.Long>
      • ensureCapacity

        void ensureCapacity​(int minCapacity)
        Ensures the backing array can fit at least minCapacity elements.
      • growSize

        private static int growSize​(int previousSize)
      • ensureIndexInRange

        private void ensureIndexInRange​(int index)
        Ensures that the provided index is within the range of [0, size]. Throws an IndexOutOfBoundsException if it is not.
        Parameters:
        index - the index to verify is in range
      • makeOutOfBoundsExceptionMessage

        private java.lang.String makeOutOfBoundsExceptionMessage​(int index)