ImmutableRangeSet<C>.asSet(DiscreteDomain<C> domain) Method


Returns an ImmutableSortedSet<E> containing the same values in the given domain contained by this range set.

Note: a.asSet(d).equals(b.asSet(d)) does not imply a.equals(b)! For example, a and b could be [2..4] and (1..5), or the empty ranges [3..3) and [4..4).

Warning: Be extremely careful what you do with the asSet view of a large range set (such as ImmutableRangeSet.of(Range.greaterThan(0))). Certain operations on such a set can be performed efficiently, but others (such as Set#hashCode or Collections#frequency) can cause major performance problems.

The returned set's Object#toString method returns a short-hand form of the set's contents, such as "[1..100]"}.

public ImmutableSortedSet<C> asSet(DiscreteDomain<C> domain)




Applies to