Package ints

Class WrappedIntArray

  • All Implemented Interfaces:
    IntArray

    public final class WrappedIntArray
    extends java.lang.Object
    implements IntArray

    Class WrappedIntArray represents an immutable int[] array.

    Instances of WrappedIntArray are immutable.
    • Constructor Summary

      Constructors 
      Constructor Description
      WrappedIntArray​(int[] ia)
      Constructs a new WrappedIntArray instance.
      WrappedIntArray​(int[] ia, int valueSize)
      Constructs a new WrappedIntArray instance.
      WrappedIntArray​(IntList il)
      Constructs a new WrappedIntArray instance.
      WrappedIntArray​(IntList il, int valueSize)
      Constructs a new WrappedIntArray instance.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int get​(int index)
      Returns the specified array element.
      int size()
      Returns the number of elements in this IntArray.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • WrappedIntArray

        public WrappedIntArray​(int[] ia)
        Constructs a new WrappedIntArray instance.
        Parameters:
        ia - an array of integers
        Throws:
        java.lang.NullPointerException - if ia == null
      • WrappedIntArray

        public WrappedIntArray​(int[] ia,
                               int valueSize)
        Constructs a new WrappedIntArray instance.
        Parameters:
        ia - an array of integers
        valueSize - the exclusive end of the range of non-negative array values
        Throws:
        java.lang.IllegalArgumentException - if (ia[j] < 0 || ia[j] > valueSize) for any index j satisfying (j >= 0 && j < ia.length)
        java.lang.NullPointerException - if ia == null
      • WrappedIntArray

        public WrappedIntArray​(IntList il)
        Constructs a new WrappedIntArray instance.
        Parameters:
        il - a list of integers
        Throws:
        java.lang.NullPointerException - if il == null
      • WrappedIntArray

        public WrappedIntArray​(IntList il,
                               int valueSize)
        Constructs a new WrappedIntArray instance.
        Parameters:
        il - a list of integers
        valueSize - the exclusive end of the range of non-negative array values
        Throws:
        java.lang.IllegalArgumentException - if (il[j] < 0 || il[j] > valueSize) for any index j satisfying (j >= 0 && j < il.length)
        java.lang.NullPointerException - if il == null
    • Method Detail

      • size

        public int size()
        Description copied from interface: IntArray
        Returns the number of elements in this IntArray.
        Specified by:
        size in interface IntArray
        Returns:
        the number of elements in this IntArray
      • get

        public int get​(int index)
        Description copied from interface: IntArray
        Returns the specified array element.
        Specified by:
        get in interface IntArray
        Parameters:
        index - an array index
        Returns:
        the specified array element
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object