Class IntArrayList

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private int[] array
      The backing store for the list.
      private static IntArrayList 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) IntArrayList()
      Constructs a new mutable IntArrayList with default capacity.
      private IntArrayList​(int[] other, int size)
      Constructs a new mutable IntArrayList 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.Integer element)  
      boolean add​(java.lang.Integer element)  
      boolean addAll​(java.util.Collection<? extends java.lang.Integer> collection)  
      void addInt​(int element)
      Like add(Integer) but more efficient in that it doesn't box the element.
      private void addInt​(int index, int element)
      Like add(int, Integer) but more efficient in that it doesn't box the element.
      boolean contains​(java.lang.Object element)  
      static IntArrayList emptyList()  
      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.Integer get​(int index)  
      int getInt​(int index)
      Like List.get(int) but more efficient in that it doesn't box the returned value.
      int hashCode()  
      int indexOf​(java.lang.Object element)  
      private java.lang.String makeOutOfBoundsExceptionMessage​(int index)  
      Internal.IntList mutableCopyWithCapacity​(int capacity)
      Returns a mutable clone of this list with the specified capacity.
      java.lang.Integer remove​(int index)  
      boolean remove​(java.lang.Object o)  
      protected void removeRange​(int fromIndex, int toIndex)  
      java.lang.Integer set​(int index, java.lang.Integer element)  
      int setInt​(int index, int 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, removeAll, replaceAll, retainAll, sort, spliterator, subList, toArray, toArray
    • Field Detail

      • array

        private int[] 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

      • IntArrayList

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

        private IntArrayList​(int[] other,
                             int size)
        Constructs a new mutable IntArrayList 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.Integer>
      • equals

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

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

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

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

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

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

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

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

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

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

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

        public void addInt​(int element)
        Like add(Integer) but more efficient in that it doesn't box the element.
        Specified by:
        addInt in interface Internal.IntList
      • addInt

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

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

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

        public java.lang.Integer remove​(int index)
        Specified by:
        remove in interface java.util.List<java.lang.Integer>
        Overrides:
        remove in class AbstractProtobufList<java.lang.Integer>
      • 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)