Class IntList

java.lang.Object
com.mta.tehreer.collections.IntList
All Implemented Interfaces:
Primitive

public abstract class IntList extends Object implements Primitive
Represents a primitive list of integers.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract void
    copyTo(int[] array, int atIndex)
    Copies all of the integers in this list to an array, starting at the specified index of the target array.
    boolean
     
    abstract int
    get(int index)
    Returns the integer at the specified index in this list.
    int
     
    static IntList
    of(int... values)
    Returns an integers list whose elements are the specified values.
    abstract int
    Returns the number of integers in this list.
    abstract IntList
    subList(int fromIndex, int toIndex)
    Returns a view of the portion of this list between the specified fromIndex, inclusive, and toIndex, exclusive.
    int[]
    Returns a new array containing all of the integers in this list in proper sequence (from first to last element).
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • IntList

      public IntList()
  • Method Details

    • of

      @NonNull public static IntList of(int... values)
      Returns an integers list whose elements are the specified values.
      Parameters:
      values - The elements of the integer list.
      Returns:
      A new integer list.
    • size

      public abstract int size()
      Returns the number of integers in this list.
      Returns:
      The number of integers in this list.
    • get

      public abstract int get(int index)
      Returns the integer at the specified index in this list.
      Parameters:
      index - Index of the integer to return.
      Returns:
      The integer at the specified index in this list.
      Throws:
      IndexOutOfBoundsException - if the index is out of range (index < 0 || index >= size()).
    • copyTo

      public abstract void copyTo(@NonNull int[] array, int atIndex)
      Copies all of the integers in this list to an array, starting at the specified index of the target array.
      Parameters:
      array - The array into which the integers of this list are to be copied.
      atIndex - The index in the target array at which copying begins.
      Throws:
      NullPointerException - if array is null.
      IndexOutOfBoundsException - for an illegal endpoint index value (atIndex < 0 || (array.length - atIndex) < size()).
    • subList

      @NonNull public abstract IntList subList(int fromIndex, int toIndex)
      Returns a view of the portion of this list between the specified fromIndex, inclusive, and toIndex, exclusive.
      Parameters:
      fromIndex - Low endpoint (inclusive) of the sub list.
      toIndex - High endpoint (exclusive) of the sub list.
      Returns:
      A view of the specified range within this list.
      Throws:
      IndexOutOfBoundsException - for an illegal endpoint index value (fromIndex < 0 || toIndex > size() || fromIndex > toIndex).
    • toArray

      @NonNull public int[] toArray()
      Returns a new array containing all of the integers in this list in proper sequence (from first to last element).
      Returns:
      A new array containing all of the integers in this list in proper sequence.
    • equals

      public boolean equals(@Nullable Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      @NonNull public String toString()
      Overrides:
      toString in class Object