Class IntList

java.lang.Object
com.amazon.ion.impl.bin.IntList

public class IntList extends Object
A list of integer values that grows as necessary. Unlike List, IntList does not require each int to be boxed. This makes it helpful in use cases where storing Integer leads to excessive time spent in garbage collection.
  • Field Details

    • DEFAULT_INITIAL_CAPACITY

      public static final int DEFAULT_INITIAL_CAPACITY
      See Also:
  • Constructor Details

    • IntList

      public IntList()
      Constructs a new IntList with a capacity of DEFAULT_INITIAL_CAPACITY.
    • IntList

      public IntList(int initialCapacity)
      Constructs a new IntList with the specified capacity.
      Parameters:
      initialCapacity - The number of ints that can be stored in this IntList before it will need to be reallocated.
    • IntList

      public IntList(IntList other)
      Constructs a new IntList that contains all the elements of the given IntList.
      Parameters:
      other - the IntList to copy.
  • Method Details

    • size

      public int size()
      Accessor.
      Returns:
      The number of ints currently stored in the list.
    • isEmpty

      public boolean isEmpty()
      Returns:
      true if there are ints stored in the list.
    • clear

      public void clear()
      Empties the list. Note that this method does not shrink the size of the backing data store.
    • get

      public int get(int index)
      Returns the indexth int in the list.
      Parameters:
      index - The list index of the desired int.
      Returns:
      The int at index index in the list.
      Throws:
      IndexOutOfBoundsException - if the index is negative or greater than the number of ints stored in the list.
    • add

      public void add(int value)
      Appends an int to the end of the list, growing the list if necessary.
      Parameters:
      value - The int to add to the end of the list.
    • toString

      public String toString()
      Overrides:
      toString in class Object