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 classprivate final class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Comparator<? super T> private final T[]private static final long -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateImmutableTreeSet(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 intintcompareTo(SortedSetIterable<T> otherSet) booleanReturns true if the iterable has an element which responds true to element.equals(object).<S> booleancorresponds(OrderedIterable<S> other, Predicate2<? super T, ? super S> predicate) Returns true if both OrderedIterables have the same length andpredicatereturns true for all corresponding elements e1 of thisOrderedIterableand e2 ofother.intdetectIndex(Predicate<? super T> predicate) Returns the index of the first element of theOrderedIterablefor which thepredicateevaluates to true.drop(int count) Returns an iterable after skipping the firstcountelements or an empty iterable if thecountis greater than the length of the iterable.voidThe procedure is executed for each element in the iterable.booleanFollows the same general contract asSet.equals(Object).first()voidIterates over the section of the iterable covered by the specified inclusive indexes.voidforEachWithIndex(int fromIndex, int toIndex, ObjectIntProcedure<? super T> objectIntProcedure) Iterates over the section of the iterable covered by the specified inclusive indexes.inthashCode()Follows the same general contract asSet.hashCode().intReturns 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) intsize()Returns the number of items in this iterable.take(int count) Returns the firstcountelements of the iterable or all the elements in the iterable ifcountis greater than the length of the iterable.private ObjectMethods inherited from class AbstractImmutableSortedSet
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, zipWithIndexMethods inherited from class AbstractImmutableCollection
add, addAll, castToCollection, chunk, clear, countBy, countByEach, countByWith, groupByUniqueKey, parallelStream, reduce, remove, removeAll, removeAllFrom, retainAll, spliterator, stream, sumByDouble, sumByFloat, sumByInt, sumByLong, toArray, toArrayMethods inherited from class 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, toBag, toBiMap, toList, toMap, toSet, toSortedBag, toSortedBag, toSortedBagBy, toSortedListBy, toSortedMap, toSortedMap, toSortedMapBy, toSortedSet, toSortedSet, toSortedSetBy, toString, zip, zipWithIndexMethods inherited from interface Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface ImmutableCollection
aggregateBy, aggregateInPlaceBy, castToCollection, countBy, countByEach, countByWith, flatCollectWith, groupByUniqueKey, parallelStream, reduceBy, spliterator, stream, sumByDouble, sumByFloat, sumByInt, sumByLongMethods inherited from interface ImmutableSortedSet
flatCollectWith, toImmutableSortedSetMethods inherited from interface InternalIterable
forEach, forEachWithMethods inherited from interface OrderedIterable
collectWithIndex, forEachWithIndex, getFirstOptional, getLastOptional, rejectWithIndex, selectWithIndex, zip, zipWithIndexMethods inherited from interface ReversibleIterable
asReversed, reverseForEach, reverseForEachWithIndexMethods inherited from interface 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, reduceBy, 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, toStringMethods inherited from interface Set
add, addAll, clear, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArrayMethods inherited from interface SortedIterable
max, minMethods inherited from interface 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:RichIterableReturns the number of items in this iterable.- Specified by:
sizein interfaceCollection<T>- Specified by:
sizein interfaceRichIterable<T>- Specified by:
sizein interfaceSet<T>
-
writeReplace
-
equals
Description copied from interface:SetIterableFollows the same general contract asSet.equals(Object). -
hashCode
public int hashCode()Description copied from interface:SetIterableFollows the same general contract asSet.hashCode(). -
contains
Description copied from interface:RichIterableReturns true if the iterable has an element which responds true to element.equals(object).- Specified by:
containsin interfaceCollection<T>- Specified by:
containsin interfaceRichIterable<T>- Specified by:
containsin interfaceSet<T>- Overrides:
containsin classAbstractRichIterable<T>
-
iterator
-
each
Description copied from interface:RichIterableThe procedure is executed for each element in the iterable.Example using a Java 8 lambda expression:
people.each(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:
eachin interfaceRichIterable<T>- See Also:
-
collectWithIndex
public <V> ImmutableList<V> collectWithIndex(ObjectIntToObjectFunction<? super T, ? extends V> function) Description copied from interface:OrderedIterableReturns a new OrderedIterable using results obtained by applying the specified function to each element and its corresponding index.- Specified by:
collectWithIndexin interfaceImmutableSortedSet<T>- Specified by:
collectWithIndexin interfaceOrderedIterable<T>- Specified by:
collectWithIndexin interfaceReversibleIterable<T>- Specified by:
collectWithIndexin interfaceSortedSetIterable<T>- Since:
- 9.1.
-
first
-
last
-
comparator
Description copied from interface:SortedSetIterableReturns the comparator used to order the elements in this set, or null if this set uses the natural ordering of its elements.- Specified by:
comparatorin interfaceSortedIterable<T>- Specified by:
comparatorin interfaceSortedSet<T>- Specified by:
comparatorin interfaceSortedSetIterable<T>
-
compareTo
- Specified by:
compareToin interfaceComparable<T>
-
compare
-
asParallel
Description copied from interface:SortedSetIterableReturns a parallel iterable of this SortedSetIterable.- Specified by:
asParallelin interfaceSetIterable<T>- Specified by:
asParallelin interfaceSortedSetIterable<T>- Overrides:
asParallelin classAbstractImmutableSortedSet<T>
-
detectIndex
Description copied from interface:OrderedIterableReturns the index of the first element of theOrderedIterablefor which thepredicateevaluates to true. Returns -1 if no element evaluates true for thepredicate.- Specified by:
detectIndexin interfaceOrderedIterable<T>- Overrides:
detectIndexin classAbstractImmutableSortedSet<T>
-
corresponds
public <S> boolean corresponds(OrderedIterable<S> other, Predicate2<? super T, ? super S> predicate) Description copied from interface:OrderedIterableReturns true if both OrderedIterables have the same length andpredicatereturns true for all corresponding elements e1 of thisOrderedIterableand e2 ofother. Thepredicateis evaluated for each element at the same position of eachOrderedIterablein a forward iteration order. This is a short circuit pattern.- Specified by:
correspondsin interfaceOrderedIterable<T>- Overrides:
correspondsin classAbstractImmutableSortedSet<T>
-
forEach
Description copied from interface:OrderedIterableIterates over the section of the iterable covered by the specified inclusive indexes. The indexes are both inclusive.e.g. OrderedIterable<Person> people = FastList.newListWith(ted, mary, bob, sally) people.forEach(0, 1, person -> LOGGER.info(person.getName()));
This code would output ted and mary's names.
- Specified by:
forEachin interfaceOrderedIterable<T>
-
forEachWithIndex
public void forEachWithIndex(int fromIndex, int toIndex, ObjectIntProcedure<? super T> objectIntProcedure) Description copied from interface:OrderedIterableIterates 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, (person, index) -> LOGGER.info(person.getName()));
This code would output ted and mary's names.
- Specified by:
forEachWithIndexin interfaceOrderedIterable<T>
-
indexOf
Description copied from interface:OrderedIterableReturns 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:
indexOfin interfaceOrderedIterable<T>- See Also:
-
take
Description copied from interface:ReversibleIterableReturns the firstcountelements of the iterable or all the elements in the iterable ifcountis greater than the length of the iterable.- Specified by:
takein interfaceImmutableSortedSet<T>- Specified by:
takein interfaceReversibleIterable<T>- Specified by:
takein interfaceSortedSetIterable<T>- Parameters:
count- the number of items to take.
-
drop
Description copied from interface:ReversibleIterableReturns an iterable after skipping the firstcountelements or an empty iterable if thecountis greater than the length of the iterable.- Specified by:
dropin interfaceImmutableSortedSet<T>- Specified by:
dropin interfaceReversibleIterable<T>- Specified by:
dropin interfaceSortedSetIterable<T>- Parameters:
count- the number of items to drop.
-