Class ISets

java.lang.Object
org.javimmutable.collections.ISets

public final class ISets extends Object
  • Method Summary

    Modifier and Type
    Method
    Description
    static <T> ISet<T>
    Constructs an unsorted set.
    static <T> ISet<T>
    hashed(Iterable<? extends T> source)
    Constructs an unsorted set containing the values from source.
    static <T> ISet<T>
    hashed(Iterator<? extends T> source)
    Constructs an unsorted set containing the values from source.
    static <T> ISet<T>
    hashed(T... source)
    Constructs an unsorted set containing the values from source.
    static <T> ISetBuilder<T>
    Constructs Builder object to produce unsorted sets.
    static <T> ISet<T>
    Constructs an empty set that sorts values based on the order they were originally added to the set.
    static <T> ISet<T>
    ordered(Iterable<? extends T> source)
    Constructs a set containing all of the values in source that sorts values based on the order they were originally added to the set.
    static <T> ISet<T>
    ordered(Iterator<? extends T> source)
    Constructs a set containing all of the values in source that sorts values based on the order they were originally added to the set.
    static <T> ISet<T>
    ordered(T... source)
    Constructs a set containing all of the values in source that sorts values based on the order they were originally added to the set.
    static <T> ISetBuilder<T>
    Constructs Builder object to produce sets that sort values based on the order they were originally added to the set.
    static <T extends Comparable<T>>
    ISet<T>
    Constructs an empty set that sorts values in their natural sort order (using ComparableComparator).
    static <T extends Comparable<T>>
    ISet<T>
    sorted(Iterable<? extends T> source)
    Constructs a set containing all of the values in source that sorts values in their natural sort order (using ComparableComparator).
    static <T> ISet<T>
    sorted(Comparator<T> comparator)
    Constructs an empty set that sorts values using comparator.
    static <T> ISet<T>
    sorted(Comparator<T> comparator, Iterable<? extends T> source)
    Constructs a set containing all of the values in source that sorts values using comparator.
    static <T> ISet<T>
    sorted(Comparator<T> comparator, Iterator<? extends T> source)
    Constructs a set containing all of the values in source that sorts values using comparator.
    static <T> ISet<T>
    sorted(Comparator<T> comparator, T... source)
    Constructs a set containing all of the values in source that sorts values using comparator.
    static <T extends Comparable<T>>
    ISet<T>
    sorted(Iterator<? extends T> source)
    Constructs a set containing all of the values in source that sorts values in their natural sort order (using ComparableComparator).
    static <T extends Comparable<T>>
    ISet<T>
    sorted(T... source)
    Constructs a set containing all of the values in source that sorts values in their natural sort order (using ComparableComparator).
    static <T extends Comparable<T>>
    ISetBuilder<T>
    Constructs a Builder object to produce sets that sort values in their natural sort order (using ComparableComparator).
    static <T> ISetBuilder<T>
    sortedBuilder(Comparator<T> comparator)
    Constructs a Builder object to produce sets that sort values using specified Comparator.

    Methods inherited from class java.lang.Object

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

    • hashed

      @Nonnull public static <T> ISet<T> hashed()
      Constructs an unsorted set.

      Implementation note: The set will adopt a hash code collision strategy based on the first value assigned to the set. All values in the map must either implement Comparable (and be comparable to all other values in the set) or not implement Comparable. Attempting to use values some of which implement Comparable and some of which do not will lead to runtime errors. It is always safest to use homogeneous values in any set.

    • hashed

      @Nonnull @SafeVarargs public static <T> ISet<T> hashed(T... source)
      Constructs an unsorted set containing the values from source.

      Implementation note: The set will adopt a hash code collision strategy based on the first value in source. All values in the map must either implement Comparable (and be comparable to all other values in the set) or not implement Comparable. Attempting to use values some of which implement Comparable and some of which do not will lead to runtime errors. It is always safest to use homogeneous values in any set.

    • hashed

      @Nonnull public static <T> ISet<T> hashed(@Nonnull Iterable<? extends T> source)
      Constructs an unsorted set containing the values from source.

      Implementation note: The set will adopt a hash code collision strategy based on the first value in source. All values in the map must either implement Comparable (and be comparable to all other values in the set) or not implement Comparable. Attempting to use values some of which implement Comparable and some of which do not will lead to runtime errors. It is always safest to use homogeneous values in any set.

    • hashed

      @Nonnull public static <T> ISet<T> hashed(@Nonnull Iterator<? extends T> source)
      Constructs an unsorted set containing the values from source.

      Implementation note: The set will adopt a hash code collision strategy based on the first value in source. All values in the map must either implement Comparable (and be comparable to all other values in the set) or not implement Comparable. Attempting to use values some of which implement Comparable and some of which do not will lead to runtime errors. It is always safest to use homogeneous values in any set.

    • sorted

      @Nonnull public static <T extends Comparable<T>> ISet<T> sorted()
      Constructs an empty set that sorts values in their natural sort order (using ComparableComparator).
    • sorted

      @Nonnull @SafeVarargs public static <T extends Comparable<T>> ISet<T> sorted(T... source)
      Constructs a set containing all of the values in source that sorts values in their natural sort order (using ComparableComparator).
    • sorted

      @Nonnull public static <T extends Comparable<T>> ISet<T> sorted(@Nonnull Iterable<? extends T> source)
      Constructs a set containing all of the values in source that sorts values in their natural sort order (using ComparableComparator).
    • sorted

      @Nonnull public static <T extends Comparable<T>> ISet<T> sorted(@Nonnull Iterator<? extends T> source)
      Constructs a set containing all of the values in source that sorts values in their natural sort order (using ComparableComparator).
    • sorted

      @Nonnull public static <T> ISet<T> sorted(@Nonnull Comparator<T> comparator)
      Constructs an empty set that sorts values using comparator.

      Note that the Comparator MUST BE IMMUTABLE. The Comparator will be retained and used throughout the life of the map and its offspring and will be aggressively shared so it is imperative that the Comparator be completely immutable.

    • sorted

      @Nonnull @SafeVarargs public static <T> ISet<T> sorted(@Nonnull Comparator<T> comparator, T... source)
      Constructs a set containing all of the values in source that sorts values using comparator.

      Note that the Comparator MUST BE IMMUTABLE. The Comparator will be retained and used throughout the life of the map and its offspring and will be aggressively shared so it is imperative that the Comparator be completely immutable.

    • sorted

      @Nonnull public static <T> ISet<T> sorted(@Nonnull Comparator<T> comparator, @Nonnull Iterable<? extends T> source)
      Constructs a set containing all of the values in source that sorts values using comparator.

      Note that the Comparator MUST BE IMMUTABLE. The Comparator will be retained and used throughout the life of the map and its offspring and will be aggressively shared so it is imperative that the Comparator be completely immutable.

    • sorted

      @Nonnull public static <T> ISet<T> sorted(@Nonnull Comparator<T> comparator, @Nonnull Iterator<? extends T> source)
      Constructs a set containing all of the values in source that sorts values using comparator.

      Note that the Comparator MUST BE IMMUTABLE. The Comparator will be retained and used throughout the life of the map and its offspring and will be aggressively shared so it is imperative that the Comparator be completely immutable.

    • ordered

      @Nonnull public static <T> ISet<T> ordered()
      Constructs an empty set that sorts values based on the order they were originally added to the set.

      Implementation note: The set will adopt a hash code collision strategy based on the first value assigned to the set. All values in the map must either implement Comparable (and be comparable to all other values in the set) or not implement Comparable. Attempting to use values some of which implement Comparable and some of which do not will lead to runtime errors. It is always safest to use homogeneous values in any set.

    • ordered

      @Nonnull @SafeVarargs public static <T> ISet<T> ordered(T... source)
      Constructs a set containing all of the values in source that sorts values based on the order they were originally added to the set.

      Implementation note: The set will adopt a hash code collision strategy based on the first value assigned to the set. All values in the map must either implement Comparable (and be comparable to all other values in the set) or not implement Comparable. Attempting to use values some of which implement Comparable and some of which do not will lead to runtime errors. It is always safest to use homogeneous values in any set.

    • ordered

      @Nonnull public static <T> ISet<T> ordered(@Nonnull Iterable<? extends T> source)
      Constructs a set containing all of the values in source that sorts values based on the order they were originally added to the set.

      Implementation note: The set will adopt a hash code collision strategy based on the first value assigned to the set. All values in the map must either implement Comparable (and be comparable to all other values in the set) or not implement Comparable. Attempting to use values some of which implement Comparable and some of which do not will lead to runtime errors. It is always safest to use homogeneous values in any set.

    • ordered

      @Nonnull public static <T> ISet<T> ordered(@Nonnull Iterator<? extends T> source)
      Constructs a set containing all of the values in source that sorts values based on the order they were originally added to the set.

      Implementation note: The set will adopt a hash code collision strategy based on the first value assigned to the set. All values in the map must either implement Comparable (and be comparable to all other values in the set) or not implement Comparable. Attempting to use values some of which implement Comparable and some of which do not will lead to runtime errors. It is always safest to use homogeneous values in any set.

    • hashedBuilder

      @Nonnull public static <T> ISetBuilder<T> hashedBuilder()
      Constructs Builder object to produce unsorted sets.

      Implementation note: The set will adopt a hash code collision strategy based on the first value assigned to the set. All values in the map must either implement Comparable (and be comparable to all other values in the set) or not implement Comparable. Attempting to use values some of which implement Comparable and some of which do not will lead to runtime errors. It is always safest to use homogeneous values in any set.

    • sortedBuilder

      @Nonnull public static <T extends Comparable<T>> ISetBuilder<T> sortedBuilder()
      Constructs a Builder object to produce sets that sort values in their natural sort order (using ComparableComparator).
    • sortedBuilder

      @Nonnull public static <T> ISetBuilder<T> sortedBuilder(@Nonnull Comparator<T> comparator)
      Constructs a Builder object to produce sets that sort values using specified Comparator.
    • orderedBuilder

      @Nonnull public static <T> ISetBuilder<T> orderedBuilder()
      Constructs Builder object to produce sets that sort values based on the order they were originally added to the set.

      Implementation note: The set will adopt a hash code collision strategy based on the first value assigned to the set. All values in the map must either implement Comparable (and be comparable to all other values in the set) or not implement Comparable. Attempting to use values some of which implement Comparable and some of which do not will lead to runtime errors. It is always safest to use homogeneous values in any set.