@Override <K extends Comparable<K>> RangeSet<K> create(RangeSet<K> contents) { return ImmutableRangeSet.copyOf(contents); } };
/** * Returns an {@code ImmutableRangeSet} representing the union of the specified ranges. * * <p>This is the smallest {@code RangeSet} which encloses each of the specified ranges. Duplicate * or connected ranges are permitted, and will be coalesced in the result. * * @since 21.0 */ public static <C extends Comparable<?>> ImmutableRangeSet<C> unionOf(Iterable<Range<C>> ranges) { return copyOf(TreeRangeSet.create(ranges)); }
/** * Returns a new range set consisting of the difference of this range set and {@code other}. * * <p>This is essentially the same as {@code TreeRangeSet.create(this).removeAll(other)} except it * returns an {@code ImmutableRangeSet}. * * @since 21.0 */ public ImmutableRangeSet<C> difference(RangeSet<C> other) { RangeSet<C> copy = TreeRangeSet.create(this); copy.removeAll(other); return copyOf(copy); }
/** * Returns an {@code ImmutableRangeSet} representing the union of the specified ranges. * * <p>This is the smallest {@code RangeSet} which encloses each of the specified ranges. Duplicate * or connected ranges are permitted, and will be coalesced in the result. * * @since 21.0 */ public static <C extends Comparable<?>> ImmutableRangeSet<C> unionOf(Iterable<Range<C>> ranges) { return copyOf(TreeRangeSet.create(ranges)); }
/** * Returns a new range set consisting of the intersection of this range set and {@code other}. * * <p>This is essentially the same as {@code * TreeRangeSet.create(this).removeAll(other.complement())} except it returns an {@code * ImmutableRangeSet}. * * @since 21.0 */ public ImmutableRangeSet<C> intersection(RangeSet<C> other) { RangeSet<C> copy = TreeRangeSet.create(this); copy.removeAll(other.complement()); return copyOf(copy); }
/** * Returns a new range set consisting of the difference of this range set and {@code other}. * * <p>This is essentially the same as {@code TreeRangeSet.create(this).removeAll(other)} except it * returns an {@code ImmutableRangeSet}. * * @since 21.0 */ public ImmutableRangeSet<C> difference(RangeSet<C> other) { RangeSet<C> copy = TreeRangeSet.create(this); copy.removeAll(other); return copyOf(copy); }
/** * Returns a new range set consisting of the difference of this range set and {@code other}. * * <p>This is essentially the same as {@code TreeRangeSet.create(this).removeAll(other)} except it * returns an {@code ImmutableRangeSet}. * * @since 21.0 */ public ImmutableRangeSet<C> difference(RangeSet<C> other) { RangeSet<C> copy = TreeRangeSet.create(this); copy.removeAll(other); return copyOf(copy); }
/** * Returns a new range set consisting of the intersection of this range set and {@code other}. * * <p>This is essentially the same as {@code * TreeRangeSet.create(this).removeAll(other.complement())} except it returns an {@code * ImmutableRangeSet}. * * @since 21.0 */ public ImmutableRangeSet<C> intersection(RangeSet<C> other) { RangeSet<C> copy = TreeRangeSet.create(this); copy.removeAll(other.complement()); return copyOf(copy); }
public void testToImmutableRangeSet() { Range<Integer> rangeOne = Range.closedOpen(1, 5); Range<Integer> rangeTwo = Range.openClosed(6, 7); ImmutableRangeSet<Integer> ranges = ImmutableRangeSet.copyOf(ImmutableList.of(rangeOne, rangeTwo)); CollectorTester.of(ImmutableRangeSet.<Integer>toImmutableRangeSet()) .expectCollects(ranges, rangeOne, rangeTwo); } }
RangeSet<Integer> copy = ImmutableRangeSet.copyOf(subset); fail(); } catch (IllegalArgumentException expected) { RangeSet<Integer> copy = ImmutableRangeSet.copyOf(subset); assertEquals(mutable, copy); assertEquals(ImmutableRangeSet.copyOf(mutable), built); assertEquals(mutable.complement(), built.complement());
@Override public RangeSet<Double> load(Field<?> field){ return ImmutableRangeSet.<Double>copyOf(parseValidRanges((Field & HasContinuousDomain)field)); } });
/** * Returns an {@code ImmutableRangeSet} containing the ranges added to this builder. */ public ImmutableRangeSet<C> build() { return copyOf(rangeSet); } }
/** * Returns an {@code ImmutableRangeSet} containing the ranges added to this builder. */ public ImmutableRangeSet<C> build() { return copyOf(rangeSet); } }
/** * Returns an {@code ImmutableRangeSet} containing the ranges added to this builder. */ public ImmutableRangeSet<C> build() { return copyOf(rangeSet); } }
/** * Returns an {@code ImmutableRangeSet} containing the ranges added to this builder. */ public ImmutableRangeSet<C> build() { return copyOf(rangeSet); } }
/** * Returns an {@code ImmutableRangeSet} containing the ranges added to this builder. */ public ImmutableRangeSet<C> build() { return copyOf(rangeSet); } }
/** * Returns an {@code ImmutableRangeSet} containing the ranges added to this builder. */ public ImmutableRangeSet<C> build() { return copyOf(rangeSet); } }
/** * Returns an {@code ImmutableRangeSet} representing the union of the specified ranges. * * <p>This is the smallest {@code RangeSet} which encloses each of the specified ranges. Duplicate * or connected ranges are permitted, and will be coalesced in the result. * * @since 21.0 */ public static <C extends Comparable<?>> ImmutableRangeSet<C> unionOf(Iterable<Range<C>> ranges) { return copyOf(TreeRangeSet.create(ranges)); }
/** * Returns an {@code ImmutableRangeSet} representing the union of the specified ranges. * * <p>This is the smallest {@code RangeSet} which encloses each of the specified ranges. Duplicate * or connected ranges are permitted, and will be coalesced in the result. * * @since 21.0 */ public static <C extends Comparable<?>> ImmutableRangeSet<C> unionOf(Iterable<Range<C>> ranges) { return copyOf(TreeRangeSet.create(ranges)); }
public NumericSet(Iterable<? extends NumericKey> keys) { TreeRangeSet<Long> rangeSet = TreeRangeSet.create(); for (NumericKey key : keys) { rangeSet.add(key.asRange()); } this.value = ImmutableRangeSet.copyOf(rangeSet); }