/** @since 12.0 */ @GwtIncompatible // NavigableSet @Override public ImmutableSortedSet<E> subSet( E fromElement, boolean fromInclusive, E toElement, boolean toInclusive) { checkNotNull(fromElement); checkNotNull(toElement); checkArgument(comparator.compare(fromElement, toElement) <= 0); return subSetImpl(fromElement, fromInclusive, toElement, toInclusive); }
/** @since 12.0 */ @GwtIncompatible // NavigableSet @Override public ImmutableSortedSet<E> subSet( E fromElement, boolean fromInclusive, E toElement, boolean toInclusive) { checkNotNull(fromElement); checkNotNull(toElement); checkArgument(comparator.compare(fromElement, toElement) <= 0); return subSetImpl(fromElement, fromInclusive, toElement, toInclusive); }
/** * A builder for creating immutable sorted set instances, especially {@code public static final} * sets ("constant sets"), with a given comparator. Example: * * <pre>{@code * public static final ImmutableSortedSet<Number> LUCKY_NUMBERS = * new ImmutableSortedSet.Builder<Number>(ODDS_FIRST_COMPARATOR) * .addAll(SINGLE_DIGIT_PRIMES) * .add(42) * .build(); * }</pre> * * <p>Builder instances can be reused; it is safe to call {@link #build} multiple times to build * multiple sets in series. Each set is a superset of the set created before it. * * @since 2.0 */ public static final class Builder<E> extends ImmutableSet.Builder<E> { private final Comparator<? super E> comparator; /** * Creates a new builder. The returned builder is equivalent to the builder generated by {@link * ImmutableSortedSet#orderedBy}. */ public Builder(Comparator<? super E> comparator) { this.comparator = checkNotNull(comparator); } /** * Adds {@code element} to the {@code ImmutableSortedSet}. If the {@code ImmutableSortedSet}
ImmutableSortedSet<E> subSet( E fromElement, boolean fromInclusive, E toElement, boolean toInclusive) { checkNotNull(fromElement); checkNotNull(toElement); checkArgument(comparator.compare(fromElement, toElement) <= 0); return subSetImpl(fromElement, fromInclusive, toElement, toInclusive); }
/** * {@inheritDoc} * * <p>This method returns a serializable {@code ImmutableSortedSet}. * * <p>The {@link SortedSet#subSet} documentation states that a subset of a * subset throws an {@link IllegalArgumentException} if passed a * {@code fromElement} smaller than an earlier {@code fromElement}. However, * this method doesn't throw an exception in that situation, but instead keeps * the original {@code fromElement}. Similarly, this method keeps the * original {@code toElement}, instead of throwing an exception, if passed a * {@code toElement} greater than an earlier {@code toElement}. */ public ImmutableSortedSet<E> subSet(E fromElement, E toElement) { checkNotNull(fromElement); checkNotNull(toElement); checkArgument(comparator.compare(fromElement, toElement) <= 0); return subSetImpl(fromElement, toElement); }
/** * @since 12.0 */ @GwtIncompatible("NavigableSet") @Override public ImmutableSortedSet<E> subSet( E fromElement, boolean fromInclusive, E toElement, boolean toInclusive) { checkNotNull(fromElement); checkNotNull(toElement); checkArgument(comparator.compare(fromElement, toElement) <= 0); return subSetImpl(fromElement, fromInclusive, toElement, toInclusive); }
/** * @since 12.0 */ @GwtIncompatible("NavigableSet") @Override public ImmutableSortedSet<E> subSet( E fromElement, boolean fromInclusive, E toElement, boolean toInclusive) { checkNotNull(fromElement); checkNotNull(toElement); checkArgument(comparator.compare(fromElement, toElement) <= 0); return subSetImpl(fromElement, fromInclusive, toElement, toInclusive); }
/** @since 12.0 */ @GwtIncompatible // NavigableSet @Override public ImmutableSortedSet<E> subSet( E fromElement, boolean fromInclusive, E toElement, boolean toInclusive) { checkNotNull(fromElement); checkNotNull(toElement); checkArgument(comparator.compare(fromElement, toElement) <= 0); return subSetImpl(fromElement, fromInclusive, toElement, toInclusive); }
/** * @since 12.0 */ @GwtIncompatible("NavigableSet") @Override public ImmutableSortedSet<E> subSet( E fromElement, boolean fromInclusive, E toElement, boolean toInclusive) { checkNotNull(fromElement); checkNotNull(toElement); checkArgument(comparator.compare(fromElement, toElement) <= 0); return subSetImpl(fromElement, fromInclusive, toElement, toInclusive); }
/** @since 12.0 */ @GwtIncompatible // NavigableSet @Override public ImmutableSortedSet<E> subSet( E fromElement, boolean fromInclusive, E toElement, boolean toInclusive) { checkNotNull(fromElement); checkNotNull(toElement); checkArgument(comparator.compare(fromElement, toElement) <= 0); return subSetImpl(fromElement, fromInclusive, toElement, toInclusive); }
/** * {@inheritDoc} * * <p>This method returns a serializable {@code ImmutableSortedSet}. * * <p>The {@link SortedSet#subSet} documentation states that a subset of a * subset throws an {@link IllegalArgumentException} if passed a * {@code fromElement} smaller than an earlier {@code fromElement}. However, * this method doesn't throw an exception in that situation, but instead keeps * the original {@code fromElement}. Similarly, this method keeps the * original {@code toElement}, instead of throwing an exception, if passed a * {@code toElement} greater than an earlier {@code toElement}. */ public ImmutableSortedSet<E> subSet(E fromElement, E toElement) { checkNotNull(fromElement); checkNotNull(toElement); checkArgument(comparator.compare(fromElement, toElement) <= 0); return subSetImpl(fromElement, toElement); }
/** * {@inheritDoc} * * <p>This method returns a serializable {@code ImmutableSortedSet}. * * <p>The {@link SortedSet#subSet} documentation states that a subset of a * subset throws an {@link IllegalArgumentException} if passed a * {@code fromElement} smaller than an earlier {@code fromElement}. However, * this method doesn't throw an exception in that situation, but instead keeps * the original {@code fromElement}. Similarly, this method keeps the * original {@code toElement}, instead of throwing an exception, if passed a * {@code toElement} greater than an earlier {@code toElement}. */ public ImmutableSortedSet<E> subSet(E fromElement, E toElement) { checkNotNull(fromElement); checkNotNull(toElement); checkArgument(comparator.compare(fromElement, toElement) <= 0); return subSetImpl(fromElement, toElement); }
/** * @since 12.0 */ @GwtIncompatible("NavigableSet") public ImmutableSortedSet<E> subSet( E fromElement, boolean fromInclusive, E toElement, boolean toInclusive) { checkNotNull(fromElement); checkNotNull(toElement); checkArgument(comparator.compare(fromElement, toElement) <= 0); return subSetImpl(fromElement, fromInclusive, toElement, toInclusive); }
/** * @since 12.0 */ @GwtIncompatible("NavigableSet") @Override public ImmutableSortedSet<E> subSet( E fromElement, boolean fromInclusive, E toElement, boolean toInclusive) { checkNotNull(fromElement); checkNotNull(toElement); checkArgument(comparator.compare(fromElement, toElement) <= 0); return subSetImpl(fromElement, fromInclusive, toElement, toInclusive); }
/** * @since 12.0 */ @GwtIncompatible("NavigableSet") @Override public ImmutableSortedSet<E> subSet( E fromElement, boolean fromInclusive, E toElement, boolean toInclusive) { checkNotNull(fromElement); checkNotNull(toElement); checkArgument(comparator.compare(fromElement, toElement) <= 0); return subSetImpl(fromElement, fromInclusive, toElement, toInclusive); }
/** * @since 12.0 */ @GwtIncompatible("NavigableSet") @Override public ImmutableSortedSet<E> subSet( E fromElement, boolean fromInclusive, E toElement, boolean toInclusive) { checkNotNull(fromElement); checkNotNull(toElement); checkArgument(comparator.compare(fromElement, toElement) <= 0); return subSetImpl(fromElement, fromInclusive, toElement, toInclusive); }
/** * @since 12.0 */ @GwtIncompatible("NavigableSet") @Override public ImmutableSortedSet<E> subSet( E fromElement, boolean fromInclusive, E toElement, boolean toInclusive) { checkNotNull(fromElement); checkNotNull(toElement); checkArgument(comparator.compare(fromElement, toElement) <= 0); return subSetImpl(fromElement, fromInclusive, toElement, toInclusive); }
/** * {@inheritDoc} * * <p>This method returns a serializable {@code ImmutableSortedSet}. * * <p>The {@link SortedSet#subSet} documentation states that a subset of a * subset throws an {@link IllegalArgumentException} if passed a * {@code fromElement} smaller than an earlier {@code fromElement}. However, * this method doesn't throw an exception in that situation, but instead keeps * the original {@code fromElement}. Similarly, this method keeps the * original {@code toElement}, instead of throwing an exception, if passed a * {@code toElement} greater than an earlier {@code toElement}. */ public ImmutableSortedSet<E> subSet(E fromElement, E toElement) { checkNotNull(fromElement); checkNotNull(toElement); checkArgument(comparator.compare(fromElement, toElement) <= 0); return subSetImpl(fromElement, toElement); }
/** * {@inheritDoc} * * <p>This method returns a serializable {@code ImmutableSortedSet}. * * <p>The {@link SortedSet#subSet} documentation states that a subset of a * subset throws an {@link IllegalArgumentException} if passed a * {@code fromElement} smaller than an earlier {@code toElement}. However, * this method doesn't throw an exception in that situation, but instead keeps * the original {@code fromElement}. Similarly, this method keeps the * original {@code toElement}, instead of throwing an exception, if passed a * {@code toElement} greater than an earlier {@code toElement}. */ public ImmutableSortedSet<E> subSet(E fromElement, E toElement) { checkNotNull(fromElement); checkNotNull(toElement); checkArgument(compare(comparator, fromElement, toElement) <= 0); return subSetImpl(fromElement, toElement); }