Class IArrays

java.lang.Object
org.javimmutable.collections.IArrays

public final class IArrays extends Object
  • Method Summary

    Modifier and Type
    Method
    Description
    static <T> IArray<T>
    allOf(Iterable<? extends T> source)
    Creates a sparse array containing all of the values from source that supports any integer (positive or negative) as an index.
    static <T> IArray<T>
    Creates a sparse array containing all of the values from source that supports any integer (positive or negative) as an index.
    static <T> IArray<T>
    allOf(Indexed<? extends T> source)
    Creates a sparse array containing all of the values from source that supports any integer (positive or negative) as an index.
    static <T> IArray<T>
    allOf(Indexed<? extends T> source, int offset, int limit)
    Creates a sparse array containing all of the values in the specified range from source that supports any integer (positive or negative) as an index.
    static <T> IArrayBuilder<T>
    Produces a Builder for efficiently constructing a IArray built atop a 32-way integer trie.
    static <T> IArray<T>
    of()
    Creates an empty sparse array that supports any integer (positive or negative) as an index.
    static <T> IArray<T>
    of(T... source)
    Creates an empty sparse array that supports any integer (positive or negative) as an index.

    Methods inherited from class java.lang.Object

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

    • of

      @Nonnull public static <T> IArray<T> of()
      Creates an empty sparse array that supports any integer (positive or negative) as an index. Indexes do not need to be consecutive there can be gaps of any size between indexes.
    • of

      @Nonnull @SafeVarargs public static <T> IArray<T> of(T... source)
      Creates an empty sparse array that supports any integer (positive or negative) as an index. Indexes do not need to be consecutive there can be gaps of any size between indexes. Copies all values into the array starting at index zero.
    • allOf

      @Nonnull public static <T> IArray<T> allOf(@Nonnull Iterator<IMapEntry<Integer,T>> source)
      Creates a sparse array containing all of the values from source that supports any integer (positive or negative) as an index. Indexes do not need to be consecutive there can be gaps of any size between indexes. Copies all entries into the array using each key as an index for storing the corresponding value.
    • allOf

      @Nonnull public static <T> IArray<T> allOf(@Nonnull Indexed<? extends T> source)
      Creates a sparse array containing all of the values from source that supports any integer (positive or negative) as an index. Indexes do not need to be consecutive there can be gaps of any size between indexes. Copies all entries into the array using each key as an index for storing the corresponding value.
    • allOf

      @Nonnull public static <T> IArray<T> allOf(@Nonnull Indexed<? extends T> source, int offset, int limit)
      Creates a sparse array containing all of the values in the specified range from source that supports any integer (positive or negative) as an index. Indexes do not need to be consecutive there can be gaps of any size between indexes. Copies all entries into the array using each key as an index for storing the corresponding value. The values copied from source are those whose index are in the range offset to (limit - 1).
    • allOf

      @Nonnull public static <T> IArray<T> allOf(@Nonnull Iterable<? extends T> source)
      Creates a sparse array containing all of the values from source that supports any integer (positive or negative) as an index. Indexes do not need to be consecutive there can be gaps of any size between indexes. Copies all entries into the array using each key as an index for storing the corresponding value.
    • builder

      @Nonnull public static <T> IArrayBuilder<T> builder()
      Produces a Builder for efficiently constructing a IArray built atop a 32-way integer trie. All values added by the builder are assigned consecutive indices starting with zero.