Class ImmutableTreeSet<T>
java.lang.Object
org.eclipse.collections.impl.AbstractRichIterable<T>
org.eclipse.collections.impl.collection.immutable.AbstractImmutableCollection<T>
org.eclipse.collections.impl.set.sorted.immutable.AbstractImmutableSortedSet<T>
org.eclipse.collections.impl.set.sorted.immutable.ImmutableTreeSet<T>
- All Implemented Interfaces:
Serializable
,Comparable<SortedSetIterable<T>>
,Iterable<T>
,Collection<T>
,SequencedCollection<T>
,SequencedSet<T>
,Set<T>
,SortedSet<T>
,ImmutableCollection<T>
,InternalIterable<T>
,OrderedIterable<T>
,ReversibleIterable<T>
,SortedIterable<T>
,RichIterable<T>
,ImmutableSetIterable<T>
,SetIterable<T>
,ImmutableSortedSet<T>
,SortedSetIterable<T>
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate final class
private final class
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Comparator
<? super T> private final T[]
private static final long
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
ImmutableTreeSet
(T[] input, Comparator<? super T> inputComparator, boolean isSortedAndUnique) -
Method Summary
Modifier and TypeMethodDescriptionasParallel
(ExecutorService executorService, int batchSize) Returns a parallel iterable of this SortedSetIterable.<V> ImmutableList
<V> collectWithIndex
(ObjectIntToObjectFunction<? super T, ? extends V> function) Returns a new OrderedIterable using results obtained by applying the specified function to each element and its corresponding index.Comparator
<? super T> Returns the comparator used to order the elements in this set, or null if this set uses the natural ordering of its elements.private int
int
compareTo
(SortedSetIterable<T> otherSet) boolean
Returns true if the iterable has an element which responds true to element.equals(object).<S> boolean
corresponds
(OrderedIterable<S> other, Predicate2<? super T, ? super S> predicate) Returns true if both OrderedIterables have the same length andpredicate
returns true for all corresponding elements e1 of thisOrderedIterable
and e2 ofother
.int
detectIndex
(Predicate<? super T> predicate) Returns the index of the first element of theOrderedIterable
for which thepredicate
evaluates to true.drop
(int count) Returns an iterable after skipping the firstcount
elements or an empty iterable if thecount
is greater than the length of the iterable.void
The procedure is executed for each element in the iterable.boolean
Follows the same general contract asSet.equals(Object)
.first()
void
Iterates over the section of the iterable covered by the specified inclusive indexes.void
forEachWithIndex
(int fromIndex, int toIndex, ObjectIntProcedure<? super T> objectIntProcedure) Iterates over the section of the iterable covered by the specified inclusive indexes.int
hashCode()
Follows the same general contract asSet.hashCode()
.int
Returns the index of the first occurrence of the specified item in this iterable, or -1 if this iterable does not contain the item.iterator()
last()
static <T> ImmutableSortedSet
<T> static <T> ImmutableSortedSet
<T> newSetFromIterable
(Iterable<? extends T> iterable) static <T> ImmutableSortedSet
<T> newSetFromIterable
(Comparator<? super T> comparator, Iterable<? extends T> iterable) static <T> ImmutableSortedSet
<T> newSetWith
(Comparator<? super T> comparator, T... elements) static <T> ImmutableSortedSet
<T> newSetWith
(T... elements) int
size()
Returns the number of items in this iterable.take
(int count) Returns the firstcount
elements of the iterable or all the elements in the iterable ifcount
is greater than the length of the iterable.private Object
Methods inherited from class org.eclipse.collections.impl.set.sorted.immutable.AbstractImmutableSortedSet
asReversed, cartesianProduct, castToSortedSet, collect, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectIf, collectInt, collectLong, collectShort, collectWith, detectLastIndex, difference, differenceInto, distinct, dropWhile, flatCollect, getFirst, getLast, groupBy, groupByEach, headSet, intersect, intersectInto, isProperSubsetOf, isSubsetOf, newMutable, newWith, newWithAll, newWithout, newWithoutAll, partition, partitionWhile, partitionWith, powerSet, reject, rejectWith, select, selectInstancesOf, selectWith, subSet, symmetricDifference, symmetricDifferenceInto, tailSet, takeWhile, tap, toImmutable, toReversed, toStack, union, unionInto, zip, zipWithIndex
Methods inherited from class org.eclipse.collections.impl.collection.immutable.AbstractImmutableCollection
add, addAll, castToCollection, chunk, clear, countBy, countByEach, countByWith, groupByUniqueKey, parallelStream, reduce, remove, removeAll, removeAllFrom, retainAll, spliterator, stream, sumByDouble, sumByFloat, sumByInt, sumByLong
Methods inherited from class org.eclipse.collections.impl.AbstractRichIterable
allSatisfy, allSatisfyWith, anySatisfy, anySatisfyWith, appendString, appendString, asLazy, collect, collectIf, collectWith, containsAll, containsAllArguments, containsAllIterable, count, countWith, detect, detectOptional, detectWith, detectWithIfNone, detectWithOptional, flatCollect, forEach, forEachWith, forEachWithIndex, groupBy, groupByEach, groupByUniqueKey, injectInto, injectInto, injectInto, injectInto, injectInto, into, isEmpty, max, max, maxBy, min, min, minBy, noneSatisfy, noneSatisfyWith, reject, rejectWith, select, selectWith, sumOfDouble, sumOfFloat, sumOfInt, sumOfLong, toArray, toArray, toBag, toBiMap, toList, toMap, toSet, toSortedBag, toSortedBag, toSortedBagBy, toSortedListBy, toSortedMap, toSortedMap, toSortedMapBy, toSortedSet, toSortedSet, toSortedSetBy, toString, zip, zipWithIndex
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
Methods inherited from interface org.eclipse.collections.api.collection.ImmutableCollection
aggregateBy, aggregateInPlaceBy, castToCollection, countBy, countByEach, countByWith, flatCollectWith, groupByUniqueKey, parallelStream, spliterator, stream, sumByDouble, sumByFloat, sumByInt, sumByLong
Methods inherited from interface org.eclipse.collections.api.set.sorted.ImmutableSortedSet
flatCollectWith, toImmutableSortedSet
Methods inherited from interface org.eclipse.collections.api.InternalIterable
forEach, forEachWith
Methods inherited from interface org.eclipse.collections.api.ordered.OrderedIterable
collectWithIndex, forEachWithIndex, getFirstOptional, getLastOptional, rejectWithIndex, selectWithIndex, zip, zipWithIndex
Methods inherited from interface org.eclipse.collections.api.ordered.ReversibleIterable
reverseForEach, reverseForEachWithIndex
Methods inherited from interface org.eclipse.collections.api.RichIterable
aggregateBy, allSatisfy, allSatisfyWith, anySatisfy, anySatisfyWith, appendString, appendString, appendString, asLazy, chunk, collect, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectIf, collectInt, collectLong, collectShort, collectWith, containsAll, containsAllArguments, containsAllIterable, containsAny, containsAnyIterable, containsBy, containsNone, containsNoneIterable, count, countBy, countByEach, countByWith, countWith, detect, detectIfNone, detectOptional, detectWith, detectWithIfNone, detectWithOptional, flatCollect, flatCollectBoolean, flatCollectByte, flatCollectChar, flatCollectDouble, flatCollectFloat, flatCollectInt, flatCollectLong, flatCollectShort, flatCollectWith, forEach, getAny, getOnly, groupBy, groupByAndCollect, groupByEach, groupByUniqueKey, injectInto, injectInto, injectInto, injectInto, injectInto, injectIntoDouble, injectIntoFloat, injectIntoInt, injectIntoLong, into, isEmpty, makeString, makeString, makeString, makeString, max, maxBy, maxByOptional, maxOptional, maxOptional, min, minBy, minByOptional, minOptional, minOptional, noneSatisfy, noneSatisfyWith, notEmpty, reduce, reduceInPlace, reduceInPlace, reject, rejectWith, select, selectWith, summarizeDouble, summarizeFloat, summarizeInt, summarizeLong, sumOfDouble, sumOfFloat, sumOfInt, sumOfLong, toArray, toArray, toBag, toBiMap, toImmutableBag, toImmutableBiMap, toImmutableList, toImmutableMap, toImmutableSet, toImmutableSortedBag, toImmutableSortedBag, toImmutableSortedBagBy, toImmutableSortedList, toImmutableSortedList, toImmutableSortedListBy, toImmutableSortedSet, toImmutableSortedSetBy, toList, toMap, toMap, toSet, toSortedBag, toSortedBag, toSortedBagBy, toSortedList, toSortedList, toSortedListBy, toSortedMap, toSortedMap, toSortedMapBy, toSortedSet, toSortedSet, toSortedSetBy, toString
Methods inherited from interface java.util.Set
add, addAll, clear, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray
Methods inherited from interface org.eclipse.collections.api.ordered.SortedIterable
max, min
Methods inherited from interface java.util.SortedSet
addFirst, addLast, removeFirst, removeLast, reversed, spliterator
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
delegate
-
comparator
-
-
Constructor Details
-
ImmutableTreeSet
private ImmutableTreeSet(T[] input, Comparator<? super T> inputComparator, boolean isSortedAndUnique)
-
-
Method Details
-
newSetWith
-
newSetWith
-
newSet
-
newSetFromIterable
-
newSetFromIterable
public static <T> ImmutableSortedSet<T> newSetFromIterable(Comparator<? super T> comparator, Iterable<? extends T> iterable) -
size
public int size()Description copied from interface:RichIterable
Returns the number of items in this iterable.- Specified by:
size
in interfaceCollection<T>
- Specified by:
size
in interfaceRichIterable<T>
- Specified by:
size
in interfaceSet<T>
-
writeReplace
-
equals
Description copied from interface:SetIterable
Follows the same general contract asSet.equals(Object)
. -
hashCode
public int hashCode()Description copied from interface:SetIterable
Follows the same general contract asSet.hashCode()
. -
contains
Description copied from interface:RichIterable
Returns true if the iterable has an element which responds true to element.equals(object).- Specified by:
contains
in interfaceCollection<T>
- Specified by:
contains
in interfaceRichIterable<T>
- Specified by:
contains
in interfaceSet<T>
- Overrides:
contains
in classAbstractRichIterable<T>
-
iterator
-
each
Description copied from interface:RichIterable
The procedure is executed for each element in the iterable.Example using a Java 8 lambda expression:
people.each(person -> LOGGER.info(person.getName()));
Example using an anonymous inner class:
people.each(new Procedure<Person>() { public void value(Person person) { LOGGER.info(person.getName()); } });
This method is a variant ofInternalIterable.forEach(Procedure)
that has a signature conflict withIterable.forEach(java.util.function.Consumer)
.- Specified by:
each
in interfaceRichIterable<T>
- See Also:
-
collectWithIndex
public <V> ImmutableList<V> collectWithIndex(ObjectIntToObjectFunction<? super T, ? extends V> function) Description copied from interface:OrderedIterable
Returns a new OrderedIterable using results obtained by applying the specified function to each element and its corresponding index.- Specified by:
collectWithIndex
in interfaceImmutableSortedSet<T>
- Specified by:
collectWithIndex
in interfaceOrderedIterable<T>
- Specified by:
collectWithIndex
in interfaceReversibleIterable<T>
- Specified by:
collectWithIndex
in interfaceSortedSetIterable<T>
- Since:
- 9.1.
-
first
-
last
-
comparator
Description copied from interface:SortedSetIterable
Returns the comparator used to order the elements in this set, or null if this set uses the natural ordering of its elements.- Specified by:
comparator
in interfaceSortedIterable<T>
- Specified by:
comparator
in interfaceSortedSet<T>
- Specified by:
comparator
in interfaceSortedSetIterable<T>
-
compareTo
- Specified by:
compareTo
in interfaceComparable<T>
-
compare
-
asParallel
Description copied from interface:SortedSetIterable
Returns a parallel iterable of this SortedSetIterable.- Specified by:
asParallel
in interfaceSetIterable<T>
- Specified by:
asParallel
in interfaceSortedSetIterable<T>
- Overrides:
asParallel
in classAbstractImmutableSortedSet<T>
-
detectIndex
Description copied from interface:OrderedIterable
Returns the index of the first element of theOrderedIterable
for which thepredicate
evaluates to true. Returns -1 if no element evaluates true for thepredicate
.- Specified by:
detectIndex
in interfaceOrderedIterable<T>
- Overrides:
detectIndex
in classAbstractImmutableSortedSet<T>
-
corresponds
Description copied from interface:OrderedIterable
Returns true if both OrderedIterables have the same length andpredicate
returns true for all corresponding elements e1 of thisOrderedIterable
and e2 ofother
. Thepredicate
is evaluated for each element at the same position of eachOrderedIterable
in a forward iteration order. This is a short circuit pattern.- Specified by:
corresponds
in interfaceOrderedIterable<T>
- Overrides:
corresponds
in classAbstractImmutableSortedSet<T>
-
forEach
Description copied from interface:OrderedIterable
Iterates over the section of the iterable covered by the specified inclusive indexes. The indexes are both inclusive.e.g. OrderedIterable<People> people = FastList.newListWith(ted, mary, bob, sally) people.forEach(0, 1, new Procedure<Person>() { public void value(Person person) { LOGGER.info(person.getName()); } });
This code would output ted and mary's names.
- Specified by:
forEach
in interfaceOrderedIterable<T>
-
forEachWithIndex
public void forEachWithIndex(int fromIndex, int toIndex, ObjectIntProcedure<? super T> objectIntProcedure) Description copied from interface:OrderedIterable
Iterates over the section of the iterable covered by the specified inclusive indexes. The indexes are both inclusive.e.g. OrderedIterable<People> people = FastList.newListWith(ted, mary, bob, sally) people.forEachWithIndex(0, 1, new ObjectIntProcedure<Person>() { public void value(Person person, int index) { LOGGER.info(person.getName()); } });
This code would output ted and mary's names.
- Specified by:
forEachWithIndex
in interfaceOrderedIterable<T>
-
indexOf
Description copied from interface:OrderedIterable
Returns the index of the first occurrence of the specified item in this iterable, or -1 if this iterable does not contain the item.- Specified by:
indexOf
in interfaceOrderedIterable<T>
- See Also:
-
take
Description copied from interface:ReversibleIterable
Returns the firstcount
elements of the iterable or all the elements in the iterable ifcount
is greater than the length of the iterable.- Specified by:
take
in interfaceImmutableSortedSet<T>
- Specified by:
take
in interfaceReversibleIterable<T>
- Specified by:
take
in interfaceSortedSetIterable<T>
- Parameters:
count
- the number of items to take.
-
drop
Description copied from interface:ReversibleIterable
Returns an iterable after skipping the firstcount
elements or an empty iterable if thecount
is greater than the length of the iterable.- Specified by:
drop
in interfaceImmutableSortedSet<T>
- Specified by:
drop
in interfaceReversibleIterable<T>
- Specified by:
drop
in interfaceSortedSetIterable<T>
- Parameters:
count
- the number of items to drop.
-