Class IntImmutableList

All Implemented Interfaces:
IntCollection, IntIterable, IntList, it.unimi.dsi.fastutil.ints.IntStack, it.unimi.dsi.fastutil.Stack<Integer>, Serializable, Cloneable, Comparable<List<? extends Integer>>, Iterable<Integer>, Collection<Integer>, List<Integer>, RandomAccess, SequencedCollection<Integer>

public class IntImmutableList extends AbstractIntList implements IntList, RandomAccess, Cloneable, Serializable
A type-specific array-based immutable list; provides some additional methods that use polymorphism to avoid (un)boxing.

Instances of this class are immutable and (contrarily to mutable array-based list implementations) the backing array is not exposed. Instances can be built using a variety of methods, but note that constructors using an array will not make a defensive copy.

This class implements the bulk method getElements() using high-performance system calls (e.g., System.arraycopy()) instead of expensive loops.

See Also:
  • Constructor Details

    • IntImmutableList

      public IntImmutableList(int[] a)
      Creates a new immutable list using a given array.

      Note that this constructor does not perform a defensive copy.

      Parameters:
      a - the array that will be used to back this immutable list.
    • IntImmutableList

      public IntImmutableList(Collection<? extends Integer> c)
      Creates a new immutable list and fills it with a given collection.
      Parameters:
      c - a collection that will be used to fill the immutable list.
    • IntImmutableList

      public IntImmutableList(IntCollection c)
      Creates a new immutable list and fills it with a given type-specific collection.
      Parameters:
      c - a type-specific collection that will be used to fill the immutable list.
    • IntImmutableList

      public IntImmutableList(IntList l)
      Creates a new immutable list and fills it with a given type-specific list.
      Parameters:
      l - a type-specific list that will be used to fill the immutable list.
    • IntImmutableList

      public IntImmutableList(int[] a, int offset, int length)
      Creates a new immutable list and fills it with the elements of a given array.
      Parameters:
      a - an array whose elements will be used to fill the immutable list.
      offset - the first element to use.
      length - the number of elements to use.
    • IntImmutableList

      public IntImmutableList(it.unimi.dsi.fastutil.ints.IntIterator i)
      Creates a new immutable list and fills it with the elements returned by a type-specific iterator..
      Parameters:
      i - a type-specific iterator whose returned elements will fill the immutable list.
  • Method Details