Class ImmutableArray<T>


  • public class ImmutableArray<T>
    extends java.lang.Object
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static <T> ImmutableArray<T> from​(T[] a)
      Factory alternative to the constructor.
      T get​(int index)
      Get the specified element.
      int length()
      Get the number of elements in the array.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • from

        public static <T> ImmutableArray<T> from​(T[] a)
        Factory alternative to the constructor.
        Parameters:
        a - the array
        Returns:
        the immutable array
      • get

        public T get​(int index)
        Get the specified element.
        Parameters:
        index - the index of the element
        Returns:
        the value of the element
        Throws:
        java.lang.ArrayIndexOutOfBoundsException - if the index is less than zero or larger than the array
      • length

        public int length()
        Get the number of elements in the array.
        Returns:
        the number of elements in the array.