Package com.google.common.collect
Class ImmutableSortedSet.Builder<E>
- java.lang.Object
-
- com.google.common.collect.ImmutableCollection.Builder<E>
-
- com.google.common.collect.ImmutableSet.Builder<E>
-
- com.google.common.collect.ImmutableSortedSet.Builder<E>
-
- Enclosing class:
- ImmutableSortedSet<E>
@Deprecated(since="2022-12-01") public static final class ImmutableSortedSet.Builder<E> extends ImmutableSet.Builder<E>
Deprecated.The Google Guava Core Libraries are deprecated and will not be part of the AEM SDK after April 2023A builder for creating immutable sorted set instances, especiallypublic static final
sets ("constant sets"), with a given comparator. Example:public static final ImmutableSortedSet<Number> LUCKY_NUMBERS = new ImmutableSortedSet.Builder<Number>(ODDS_FIRST_COMPARATOR) .addAll(SINGLE_DIGIT_PRIMES) .add(42) .build();
Builder instances can be reused; it is safe to call
build()
multiple times to build multiple sets in series. Each set is a superset of the set created before it.- Since:
- 2.0 (imported from Google Collections Library)
-
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description ImmutableSortedSet.Builder<E>
add(E element)
Deprecated.Addselement
to theImmutableSortedSet
.ImmutableSortedSet.Builder<E>
add(E... elements)
Deprecated.Adds each element ofelements
to theImmutableSortedSet
, ignoring duplicate elements (only the first duplicate element is added).ImmutableSortedSet.Builder<E>
addAll(java.lang.Iterable<? extends E> elements)
Deprecated.Adds each element ofelements
to theImmutableSortedSet
, ignoring duplicate elements (only the first duplicate element is added).ImmutableSortedSet.Builder<E>
addAll(java.util.Iterator<? extends E> elements)
Deprecated.Adds each element ofelements
to theImmutableSortedSet
, ignoring duplicate elements (only the first duplicate element is added).ImmutableSortedSet<E>
build()
Deprecated.Returns a newly-createdImmutableSortedSet
based on the contents of theBuilder
and its comparator.
-
-
-
Constructor Detail
-
Builder
public Builder(java.util.Comparator<? super E> comparator)
Deprecated.Creates a new builder. The returned builder is equivalent to the builder generated byImmutableSortedSet.orderedBy(java.util.Comparator<E>)
.
-
-
Method Detail
-
add
public ImmutableSortedSet.Builder<E> add(E element)
Deprecated.Addselement
to theImmutableSortedSet
. If theImmutableSortedSet
already containselement
, thenadd
has no effect. (only the previously added element is retained).- Overrides:
add
in classImmutableSet.Builder<E>
- Parameters:
element
- the element to add- Returns:
- this
Builder
object - Throws:
java.lang.NullPointerException
- ifelement
is null
-
add
public ImmutableSortedSet.Builder<E> add(E... elements)
Deprecated.Adds each element ofelements
to theImmutableSortedSet
, ignoring duplicate elements (only the first duplicate element is added).- Overrides:
add
in classImmutableSet.Builder<E>
- Parameters:
elements
- the elements to add- Returns:
- this
Builder
object - Throws:
java.lang.NullPointerException
- ifelements
contains a null element
-
addAll
public ImmutableSortedSet.Builder<E> addAll(java.lang.Iterable<? extends E> elements)
Deprecated.Adds each element ofelements
to theImmutableSortedSet
, ignoring duplicate elements (only the first duplicate element is added).- Overrides:
addAll
in classImmutableSet.Builder<E>
- Parameters:
elements
- the elements to add to theImmutableSortedSet
- Returns:
- this
Builder
object - Throws:
java.lang.NullPointerException
- ifelements
contains a null element
-
addAll
public ImmutableSortedSet.Builder<E> addAll(java.util.Iterator<? extends E> elements)
Deprecated.Adds each element ofelements
to theImmutableSortedSet
, ignoring duplicate elements (only the first duplicate element is added).- Overrides:
addAll
in classImmutableSet.Builder<E>
- Parameters:
elements
- the elements to add to theImmutableSortedSet
- Returns:
- this
Builder
object - Throws:
java.lang.NullPointerException
- ifelements
contains a null element
-
build
public ImmutableSortedSet<E> build()
Deprecated.Returns a newly-createdImmutableSortedSet
based on the contents of theBuilder
and its comparator.- Overrides:
build
in classImmutableSet.Builder<E>
-
-