Class IntArrayList

  • All Implemented Interfaces:
    java.lang.Cloneable, java.lang.Iterable<java.lang.Integer>, java.util.Collection<java.lang.Integer>, java.util.List<java.lang.Integer>

    public class IntArrayList
    extends java.util.AbstractList<java.lang.Integer>
    implements java.lang.Cloneable
    An ArrayList based upon int members. Not quite a real implementation of a modifiable list as I don't do, for example, add(index,element). TODO: unused?
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected int[] elements  
      protected int n  
      • Fields inherited from class java.util.AbstractList

        modCount
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean add​(int o)  
      int capacity()  
      java.lang.Object clone()  
      boolean contains​(int v)  
      int element​(int i)  
      int[] elements()  
      void ensureCapacity​(int newCapacity)  
      boolean equals​(java.lang.Object o)  
      java.lang.Integer get​(int i)  
      protected void grow()  
      int set​(int i, int newValue)
      Set the ith element.
      void setSize​(int newSize)  
      int size()  
      java.lang.String toString()  
      • Methods inherited from class java.util.AbstractList

        add, add, addAll, clear, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, removeRange, set, subList
      • Methods inherited from class java.util.AbstractCollection

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

        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

      • n

        protected int n
      • elements

        protected int[] elements
    • Constructor Detail

      • IntArrayList

        public IntArrayList()
      • IntArrayList

        public IntArrayList​(int initialCapacity)
    • Method Detail

      • set

        public int set​(int i,
                       int newValue)
        Set the ith element. Like ArrayList, this does NOT affect size.
      • add

        public boolean add​(int o)
      • setSize

        public void setSize​(int newSize)
      • grow

        protected void grow()
      • contains

        public boolean contains​(int v)
      • ensureCapacity

        public void ensureCapacity​(int newCapacity)
      • get

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

        public int element​(int i)
      • elements

        public int[] elements()
      • 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>
      • capacity

        public int capacity()
      • 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 java.util.AbstractList<java.lang.Integer>
      • clone

        public java.lang.Object clone()
                               throws java.lang.CloneNotSupportedException
        Overrides:
        clone in class java.lang.Object
        Throws:
        java.lang.CloneNotSupportedException
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.util.AbstractCollection<java.lang.Integer>