Top Description Methods
org.eclipse.collections.api.bag.sorted

public Interface SortedBag<T>

extends Bag<T>, Comparable<SortedBag<T>>, SortedIterable<T>, ReversibleIterable<T>
Known Direct Subinterfaces
org.eclipse.collections.api.bag.sorted.ImmutableSortedBag, org.eclipse.collections.api.bag.sorted.MutableSortedBag
Imports
java.util.Comparator, .NoSuchElementException, org.eclipse.collections.api.bag.Bag, org.eclipse.collections.api.block.function.Function, .Function2, org.eclipse.collections.api.block.function.primitive.BooleanFunction, .ByteFunction, .CharFunction, .DoubleFunction, .FloatFunction, .IntFunction, .LongFunction, .ObjectIntToObjectFunction, .ShortFunction, org.eclipse.collections.api.block.predicate.Predicate, .Predicate2, org.eclipse.collections.api.block.predicate.primitive.IntPredicate, org.eclipse.collections.api.block.procedure.Procedure, org.eclipse.collections.api.list.ListIterable, org.eclipse.collections.api.list.primitive.BooleanList, .ByteList, .CharList, .DoubleList, .FloatList, .IntList, .LongList, .ShortList, org.eclipse.collections.api.map.sorted.SortedMapIterable, org.eclipse.collections.api.multimap.sortedbag.SortedBagMultimap, org.eclipse.collections.api.ordered.ReversibleIterable, .SortedIterable, org.eclipse.collections.api.partition.bag.sorted.PartitionSortedBag, org.eclipse.collections.api.set.sorted.SortedSetIterable, org.eclipse.collections.api.tuple.Pair

An Iterable whose elements are sorted by some comparator or their natural ordering and may contain duplicate entries.
Since
4.2

Method Summary

Modifier and TypeMethod and Description
public <V> ListIterable<V>
collect(Function<? super T, ? extends V> function)

Redeclares org.eclipse.collections.api.RichIterable.collect, org.eclipse.collections.api.ordered.OrderedIterable.collect, org.eclipse.collections.api.ordered.ReversibleIterable.collect.

Returns a new collection with the results of applying the specified function on each element of the source collection.

public BooleanList
collectBoolean(BooleanFunction<? super T> booleanFunction)

Redeclares org.eclipse.collections.api.RichIterable.collectBoolean, org.eclipse.collections.api.ordered.OrderedIterable.collectBoolean, org.eclipse.collections.api.ordered.ReversibleIterable.collectBoolean.

Returns a new primitive boolean iterable with the results of applying the specified function on each element of the source collection.

public ByteList
collectByte(ByteFunction<? super T> byteFunction)

Redeclares org.eclipse.collections.api.RichIterable.collectByte, org.eclipse.collections.api.ordered.OrderedIterable.collectByte, org.eclipse.collections.api.ordered.ReversibleIterable.collectByte.

Returns a new primitive byte iterable with the results of applying the specified function on each element of the source collection.

public CharList
collectChar(CharFunction<? super T> charFunction)

Redeclares org.eclipse.collections.api.RichIterable.collectChar, org.eclipse.collections.api.ordered.OrderedIterable.collectChar, org.eclipse.collections.api.ordered.ReversibleIterable.collectChar.

Returns a new primitive char iterable with the results of applying the specified function on each element of the source collection.

public DoubleList
collectDouble(DoubleFunction<? super T> doubleFunction)

Redeclares org.eclipse.collections.api.RichIterable.collectDouble, org.eclipse.collections.api.ordered.OrderedIterable.collectDouble, org.eclipse.collections.api.ordered.ReversibleIterable.collectDouble.

Returns a new primitive double iterable with the results of applying the specified function on each element of the source collection.

public FloatList
collectFloat(FloatFunction<? super T> floatFunction)

Redeclares org.eclipse.collections.api.RichIterable.collectFloat, org.eclipse.collections.api.ordered.OrderedIterable.collectFloat, org.eclipse.collections.api.ordered.ReversibleIterable.collectFloat.

Returns a new primitive float iterable with the results of applying the specified function on each element of the source collection.

public <V> ListIterable<V>
collectIf(Predicate<? super T> predicate, Function<? super T, ? extends V> function)

Redeclares org.eclipse.collections.api.RichIterable.collectIf, org.eclipse.collections.api.ordered.OrderedIterable.collectIf, org.eclipse.collections.api.ordered.ReversibleIterable.collectIf.

Returns a new collection with the results of applying the specified function on each element of the source collection, but only for those elements which return true upon evaluation of the predicate.

public IntList
collectInt(IntFunction<? super T> intFunction)

Redeclares org.eclipse.collections.api.RichIterable.collectInt, org.eclipse.collections.api.ordered.OrderedIterable.collectInt, org.eclipse.collections.api.ordered.ReversibleIterable.collectInt.

Returns a new primitive int iterable with the results of applying the specified function on each element of the source collection.

public LongList
collectLong(LongFunction<? super T> longFunction)

Redeclares org.eclipse.collections.api.RichIterable.collectLong, org.eclipse.collections.api.ordered.OrderedIterable.collectLong, org.eclipse.collections.api.ordered.ReversibleIterable.collectLong.

Returns a new primitive long iterable with the results of applying the specified function on each element of the source collection.

public ShortList
collectShort(ShortFunction<? super T> shortFunction)

Redeclares org.eclipse.collections.api.RichIterable.collectShort, org.eclipse.collections.api.ordered.OrderedIterable.collectShort, org.eclipse.collections.api.ordered.ReversibleIterable.collectShort.

Returns a new primitive short iterable with the results of applying the specified function on each element of the source collection.

public <P, V> ListIterable<V>
collectWith(Function2<? super T, ? super P, ? extends V> function, P parameter)

Redeclares org.eclipse.collections.api.RichIterable.collectWith, org.eclipse.collections.api.ordered.OrderedIterable.collectWith, org.eclipse.collections.api.ordered.ReversibleIterable.collectWith.

Same as collect(Function) with a Function2 and specified parameter which is passed to the block.

public default <V> ListIterable<V>
collectWithIndex(ObjectIntToObjectFunction<? super T, ? extends V> function)

Overrides default org.eclipse.collections.api.ordered.OrderedIterable.collectWithIndex, org.eclipse.collections.api.ordered.ReversibleIterable.collectWithIndex.

Returns a new OrderedIterable using results obtained by applying the specified function to each element and its corresponding index.

public <V> ListIterable<V>
collectWithOccurrences(ObjectIntToObjectFunction<? super T, ? extends V> function)

Redeclares org.eclipse.collections.api.bag.Bag.collectWithOccurrences.

Iterates over the unique elements and their occurrences and collects the results of applying the specified function.

public Comparator<? super T>
comparator()

Redeclares org.eclipse.collections.api.ordered.SortedIterable.comparator.

Returns the comparator used to order the elements in this bag, or null if this bag uses the natural ordering of its elements.

public SortedSetIterable<T>
distinct()

Redeclares org.eclipse.collections.api.ordered.SortedIterable.distinct, org.eclipse.collections.api.ordered.ReversibleIterable.distinct.

Returns a new SortedIterable containing the distinct elements in this iterable.

public SortedBag<T>
drop(int count)

Redeclares org.eclipse.collections.api.ordered.ReversibleIterable.drop.

Returns an iterable after skipping the first count elements or an empty iterable if the count is greater than the length of the iterable.

public SortedBag<T>
dropWhile(Predicate<? super T> predicate)

Redeclares org.eclipse.collections.api.ordered.SortedIterable.dropWhile, org.eclipse.collections.api.ordered.ReversibleIterable.dropWhile.

Returns the final elements that do not satisfy the Predicate.

public <V> ListIterable<V>
public default <P, V> ListIterable<V>
flatCollectWith(Function2<? super T, ? super P, ? extends Iterable<V>> function, P parameter)

Overrides default org.eclipse.collections.api.RichIterable.flatCollectWith, org.eclipse.collections.api.ordered.OrderedIterable.flatCollectWith, org.eclipse.collections.api.ordered.ReversibleIterable.flatCollectWith.

Same as flatCollect, only with a Function2 that is passed an extra parameter.

public <V> SortedBagMultimap<V, T>
groupBy(Function<? super T, ? extends V> function)

Redeclares org.eclipse.collections.api.bag.Bag.groupBy, org.eclipse.collections.api.ordered.SortedIterable.groupBy, org.eclipse.collections.api.ordered.ReversibleIterable.groupBy.

For each element of the iterable, the function is evaluated and the results of these evaluations are collected into a new multimap, where the transformed value is the key and the original values are added to the same (or similar) species of collection as the source iterable.

public <V> SortedBagMultimap<V, T>
groupByEach(Function<? super T, ? extends Iterable<V>> function)

Redeclares org.eclipse.collections.api.bag.Bag.groupByEach, org.eclipse.collections.api.ordered.SortedIterable.groupByEach, org.eclipse.collections.api.ordered.ReversibleIterable.groupByEach.

Similar to groupBy(Function), except the result of evaluating function will return a collection of keys for each value.

public T
max()

Redeclares org.eclipse.collections.api.RichIterable.max, org.eclipse.collections.api.ordered.SortedIterable.max, org.eclipse.collections.api.ordered.OrderedIterable.max.

Returns the maximum element out of this container based on the natural order, not the order of this bag.

public T
min()

Redeclares org.eclipse.collections.api.RichIterable.min, org.eclipse.collections.api.ordered.SortedIterable.min, org.eclipse.collections.api.ordered.OrderedIterable.min.

Returns the minimum element out of this container based on the natural order, not the order of this bag.

public PartitionSortedBag<T>
partition(Predicate<? super T> predicate)

Redeclares org.eclipse.collections.api.bag.Bag.partition, org.eclipse.collections.api.ordered.SortedIterable.partition, org.eclipse.collections.api.ordered.ReversibleIterable.partition.

Filters a collection into a PartitionedIterable based on the evaluation of the predicate.

public PartitionSortedBag<T>
partitionWhile(Predicate<? super T> predicate)

Redeclares org.eclipse.collections.api.ordered.SortedIterable.partitionWhile, org.eclipse.collections.api.ordered.ReversibleIterable.partitionWhile.

Returns a Partition of the initial elements that satisfy the Predicate and the remaining elements.

public <P> PartitionSortedBag<T>
partitionWith(Predicate2<? super T, ? super P> predicate, P parameter)

Redeclares org.eclipse.collections.api.bag.Bag.partitionWith, org.eclipse.collections.api.ordered.OrderedIterable.partitionWith, org.eclipse.collections.api.ordered.ReversibleIterable.partitionWith.

Filters a collection into a PartitionIterable based on the evaluation of the predicate.

public SortedBag<T>
reject(Predicate<? super T> predicate)

Redeclares org.eclipse.collections.api.bag.Bag.reject, org.eclipse.collections.api.ordered.SortedIterable.reject, org.eclipse.collections.api.ordered.ReversibleIterable.reject.

Returns all elements of the source collection that return false when evaluating of the predicate.

public <P> SortedBag<T>
rejectWith(Predicate2<? super T, ? super P> predicate, P parameter)

Redeclares org.eclipse.collections.api.bag.Bag.rejectWith, org.eclipse.collections.api.ordered.SortedIterable.rejectWith, org.eclipse.collections.api.ordered.ReversibleIterable.rejectWith.

Similar to reject(Predicate), except with an evaluation parameter for the second generic argument in Predicate2.

public SortedBag<T>
select(Predicate<? super T> predicate)

Redeclares org.eclipse.collections.api.bag.Bag.select, org.eclipse.collections.api.ordered.SortedIterable.select, org.eclipse.collections.api.ordered.ReversibleIterable.select.

Returns all elements of the source collection that return true when evaluating the predicate.

public SortedBag<T>
selectByOccurrences(IntPredicate predicate)

Redeclares org.eclipse.collections.api.bag.Bag.selectByOccurrences.

Returns all elements of the bag that have a number of occurrences that satisfy the predicate.

public default SortedBag<T>
selectDuplicates()

Overrides default org.eclipse.collections.api.bag.Bag.selectDuplicates.

Returns all elements of the bag that have more than one occurrence.

public <S> SortedBag<S>
public SortedSetIterable<T>
selectUnique()

Redeclares org.eclipse.collections.api.bag.Bag.selectUnique.

Returns a set containing all elements of the bag that have exactly one occurrence.

public <P> SortedBag<T>
selectWith(Predicate2<? super T, ? super P> predicate, P parameter)

Redeclares org.eclipse.collections.api.bag.Bag.selectWith, org.eclipse.collections.api.ordered.SortedIterable.selectWith, org.eclipse.collections.api.ordered.ReversibleIterable.selectWith.

Similar to select(Predicate), except with an evaluation parameter for the second generic argument in Predicate2.

public SortedBag<T>
take(int count)

Redeclares org.eclipse.collections.api.ordered.ReversibleIterable.take.

Returns the first count elements of the iterable or all the elements in the iterable if count is greater than the length of the iterable.

public SortedBag<T>
takeWhile(Predicate<? super T> predicate)

Redeclares org.eclipse.collections.api.ordered.SortedIterable.takeWhile, org.eclipse.collections.api.ordered.ReversibleIterable.takeWhile.

Returns the initial elements that satisfy the Predicate.

public SortedBag<T>
tap(Procedure<? super T> procedure)

Redeclares org.eclipse.collections.api.bag.Bag.tap, org.eclipse.collections.api.ordered.SortedIterable.tap, org.eclipse.collections.api.ordered.ReversibleIterable.tap.

Executes the Procedure for each element in the iterable and returns this.

public ImmutableSortedBag<T>
toImmutable()

Redeclares org.eclipse.collections.api.bag.Bag.toImmutable.

Convert the SortedBag to an ImmutableSortedBag.

public SortedMapIterable<T, Integer>
toMapOfItemToCount()

Redeclares org.eclipse.collections.api.bag.Bag.toMapOfItemToCount.

Converts the Bag to a Map of the Item type to its count as an Integer.

public SortedBag<T>
toReversed()

Redeclares org.eclipse.collections.api.ordered.ReversibleIterable.toReversed.

Returns a new ReversibleIterable in reverse order.

public SortedSetIterable<Pair<T, Integer>>
Inherited from java.lang.Comparable:
compareTo
Inherited from org.eclipse.collections.api.bag.Bag:
aggregateByallSatisfyWithOccurrencesanySatisfyWithOccurrencesbottomOccurrencescollectWithOccurrencesdetectWithOccurrencesdistinctViewequalsforEachWithOccurrenceshashCodenoneSatisfyWithOccurrencesoccurrencesOfreduceByreduceInPlacereduceInPlacesizeDistinctsummarizeDoublesummarizeFloatsummarizeIntsummarizeLongtopOccurrencestoStringOfItemToCount
Inherited from org.eclipse.collections.api.ordered.ReversibleIterable:
asReverseddetectLastIndexreverseForEachreverseForEachWithIndexzip
Inherited from org.eclipse.collections.api.ordered.SortedIterable:
zip