Top Inners Fields Constructors Methods
org.eclipse.collections.impl.bag.sorted.immutable

pack-priv Class ImmutableSortedBagImpl<T>

extends AbstractImmutableSortedBag<T>
implements Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable
Imports
java.io.Serializable, java.lang.reflect.Array, java.util.Arrays, .Collection, .Comparator, .Iterator, .List, .NoSuchElementException, .Optional, .RandomAccess, org.eclipse.collections.api.RichIterable, org.eclipse.collections.api.bag.Bag, org.eclipse.collections.api.bag.sorted.ImmutableSortedBag, .MutableSortedBag, .SortedBag, org.eclipse.collections.api.block.function.Function, org.eclipse.collections.api.block.function.primitive.ObjectIntToObjectFunction, org.eclipse.collections.api.block.predicate.Predicate, .Predicate2, org.eclipse.collections.api.block.predicate.primitive.ObjectIntPredicate, org.eclipse.collections.api.block.procedure.Procedure, org.eclipse.collections.api.block.procedure.primitive.ObjectIntProcedure, org.eclipse.collections.api.factory.SortedBags, .SortedSets, org.eclipse.collections.api.list.ImmutableList, .MutableList, org.eclipse.collections.api.map.sorted.MutableSortedMap, org.eclipse.collections.api.ordered.OrderedIterable, org.eclipse.collections.api.partition.bag.sorted.PartitionImmutableSortedBag, org.eclipse.collections.api.set.sorted.ImmutableSortedSet, .MutableSortedSet, org.eclipse.collections.impl.Counter, org.eclipse.collections.impl.block.factory.Comparators, org.eclipse.collections.impl.list.fixed.ArrayAdapter, org.eclipse.collections.impl.list.mutable.FastList, org.eclipse.collections.impl.map.sorted.mutable.TreeSortedMap, org.eclipse.collections.impl.partition.bag.sorted.PartitionImmutableSortedBagImpl, .PartitionTreeBag, org.eclipse.collections.impl.utility.ArrayIterate, .ListIterate, org.eclipse.collections.impl.utility.internal.SortedBagIterables

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class

Field Summary

Modifier and TypeField and Description
private final Comparator<? super T>
private final T[]
private final int[]
private static final long
private final int

Constructor Summary

AccessConstructor and Description
pack-priv
private
ImmutableSortedBagImpl(T[] elements, int[] occurrences, Comparator<? super T> comparator)

Method Summary

Modifier and TypeMethod and Description
public boolean
allSatisfy(Predicate<? super T> predicate)

Overrides org.eclipse.collections.impl.AbstractRichIterable.allSatisfy.

Implements org.eclipse.collections.api.RichIterable.allSatisfy.

Returns true if the predicate evaluates to true for every element of the iterable or if the iterable is empty.

public <P> boolean
allSatisfyWith(Predicate2<? super T, ? super P> predicate, P parameter)

Overrides org.eclipse.collections.impl.AbstractRichIterable.allSatisfyWith.

Implements org.eclipse.collections.api.RichIterable.allSatisfyWith.

Returns true if the predicate evaluates to true for every element of the collection, or returns false.

public boolean
allSatisfyWithOccurrences(ObjectIntPredicate<? super T> predicate)

Implements org.eclipse.collections.api.bag.Bag.allSatisfyWithOccurrences.

Returns true if the predicate evaluates to true for all elements of the Bag.

public boolean
anySatisfy(Predicate<? super T> predicate)

Overrides org.eclipse.collections.impl.AbstractRichIterable.anySatisfy.

Implements org.eclipse.collections.api.RichIterable.anySatisfy.

Returns true if the predicate evaluates to true for any element of the iterable.

public <P> boolean
anySatisfyWith(Predicate2<? super T, ? super P> predicate, P parameter)

Overrides org.eclipse.collections.impl.AbstractRichIterable.anySatisfyWith.

Implements org.eclipse.collections.api.RichIterable.anySatisfyWith.

Returns true if the predicate evaluates to true for any element of the collection, or return false.

public boolean
anySatisfyWithOccurrences(ObjectIntPredicate<? super T> predicate)

Implements org.eclipse.collections.api.bag.Bag.anySatisfyWithOccurrences.

Returns true if the predicate evaluates to true for any element of the Bag.

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

Overrides default org.eclipse.collections.api.bag.sorted.ImmutableSortedBag.collectWithIndex.

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

public <V, R extends Collection<V>> R
collectWithIndex(ObjectIntToObjectFunction<? super T, ? extends V> function, R target)

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

Adds elements to the target Collection using results obtained by applying the specified function to each element and its corresponding index.

public Comparator<? super T>
comparator()

Implements org.eclipse.collections.api.bag.sorted.SortedBag.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 int
compareTo(SortedBag<T> otherBag)

Implements java.lang.Comparable.compareTo.

Compares this object with the specified object for order.

public boolean
contains(Object object)

Overrides org.eclipse.collections.impl.AbstractRichIterable.contains.

Implements org.eclipse.collections.api.RichIterable.contains, java.util.Collection.contains.

Returns true if the iterable has an element which responds true to element.equals(object).

public <S> boolean
corresponds(OrderedIterable<S> other, Predicate2<? super T, ? super S> predicate)

Implements org.eclipse.collections.api.ordered.OrderedIterable.corresponds.

Returns true if both OrderedIterables have the same length and predicate returns true for all corresponding elements e1 of this OrderedIterable and e2 of other.

public T
detect(Predicate<? super T> predicate)

Overrides org.eclipse.collections.impl.AbstractRichIterable.detect.

Implements org.eclipse.collections.api.RichIterable.detect.

Returns the first element of the iterable for which the predicate evaluates to true or null in the case where no element returns true.

public int
detectIndex(Predicate<? super T> predicate)

Implements org.eclipse.collections.api.ordered.OrderedIterable.detectIndex.

Returns the index of the first element of the OrderedIterable for which the predicate evaluates to true.

private int
detectNotIndex(Predicate<? super T> predicate)

public Optional<T>
detectOptional(Predicate<? super T> predicate)

Overrides org.eclipse.collections.impl.AbstractRichIterable.detectOptional.

Implements org.eclipse.collections.api.RichIterable.detectOptional.

Returns the first element of the iterable for which the predicate evaluates to true as an Optional.

public T
detectWithOccurrences(ObjectIntPredicate<? super T> predicate)

Implements org.eclipse.collections.api.bag.Bag.detectWithOccurrences.

Returns an element of the Bag that satisfies the predicate or null if such an element does not exist

public ImmutableSortedSet<T>
distinct()

Implements org.eclipse.collections.api.bag.sorted.ImmutableSortedBag.distinct.

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

public RichIterable<T>
distinctView()

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

Returns an unmodifiable view on the distinct elements with the same complexity as the Bag implementation.

public ImmutableSortedBag<T>
drop(int count)

Implements org.eclipse.collections.api.bag.sorted.ImmutableSortedBag.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 ImmutableSortedBag<T>
dropWhile(Predicate<? super T> predicate)

Implements org.eclipse.collections.api.bag.sorted.ImmutableSortedBag.dropWhile.

Returns the final elements that do not satisfy the Predicate.

public void
each(Procedure<? super T> procedure)

Implements org.eclipse.collections.api.RichIterable.each.

The procedure is executed for each element in the iterable.

public boolean
equals(Object other)

Overrides java.lang.Object.equals.

Implements org.eclipse.collections.api.bag.Bag.equals, java.util.Collection.equals.

Two bags b1 and b2 are equal if m1.toMapOfItemToCount().equals(m2.toMapOfItemToCount()).

public void
forEach(int fromIndex, int toIndex, Procedure<? super T> procedure)

Implements org.eclipse.collections.api.ordered.OrderedIterable.forEach.

Iterates over the section of the iterable covered by the specified inclusive indexes.

public void
forEachWithIndex(ObjectIntProcedure<? super T> objectIntProcedure)

Overrides org.eclipse.collections.impl.AbstractRichIterable.forEachWithIndex.

Implements org.eclipse.collections.api.InternalIterable.forEachWithIndex, org.eclipse.collections.api.ordered.OrderedIterable.forEachWithIndex.

Iterates over the iterable passing each element and the current relative int index to the specified instance of ObjectIntProcedure.

public void
forEachWithIndex(int fromIndex, int toIndex, ObjectIntProcedure<? super T> objectIntProcedure)

Implements org.eclipse.collections.api.ordered.OrderedIterable.forEachWithIndex.

Iterates over the section of the iterable covered by the specified inclusive indexes.

public void
forEachWithOccurrences(ObjectIntProcedure<? super T> procedure)

Implements org.eclipse.collections.api.bag.Bag.forEachWithOccurrences.

For each distinct item, with the number of occurrences, execute the specified procedure.

public T
public T
public int
hashCode()

Overrides java.lang.Object.hashCode.

Implements org.eclipse.collections.api.bag.Bag.hashCode, java.util.Collection.hashCode.

Returns the hash code for this Bag, defined as this.

public int
indexOf(Object object)

Overrides default org.eclipse.collections.api.ordered.OrderedIterable.indexOf.

Returns the index of the first occurrence of the specified item in this iterable, or -1 if this iterable does not contain the item.

public Iterator<T>
iterator()

Implements java.lang.Iterable.iterator, java.util.Collection.iterator.

Returns an iterator over elements of type T.

public T
max()

Overrides org.eclipse.collections.impl.AbstractRichIterable.max.

Implements org.eclipse.collections.api.RichIterable.max, org.eclipse.collections.api.bag.sorted.SortedBag.max.

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

public T
max(Comparator<? super T> comparator)

Overrides org.eclipse.collections.impl.AbstractRichIterable.max.

Implements org.eclipse.collections.api.RichIterable.max.

Returns the maximum element out of this container based on the comparator.

public <V extends Comparable<? super V>> T
maxBy(Function<? super T, ? extends V> function)

Overrides org.eclipse.collections.impl.AbstractRichIterable.maxBy.

Implements org.eclipse.collections.api.RichIterable.maxBy.

Returns the maximum elements out of this container based on the natural order of the attribute returned by Function.

public T
min()

Overrides org.eclipse.collections.impl.AbstractRichIterable.min.

Implements org.eclipse.collections.api.RichIterable.min, org.eclipse.collections.api.bag.sorted.SortedBag.min.

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

public T
min(Comparator<? super T> comparator)

Overrides org.eclipse.collections.impl.AbstractRichIterable.min.

Implements org.eclipse.collections.api.RichIterable.min.

Returns the minimum element out of this container based on the comparator.

public <V extends Comparable<? super V>> T
minBy(Function<? super T, ? extends V> function)

Overrides org.eclipse.collections.impl.AbstractRichIterable.minBy.

Implements org.eclipse.collections.api.RichIterable.minBy.

Returns the minimum elements out of this container based on the natural order of the attribute returned by Function.

public ImmutableSortedBag<T>
newWith(T element)

Implements org.eclipse.collections.api.bag.sorted.ImmutableSortedBag.newWith, org.eclipse.collections.api.collection.ImmutableCollection.newWith.

This method is similar to the with method in MutableCollection with the difference that a new copy of this collection with the element appended will be returned.

public ImmutableSortedBag<T>
newWithAll(Iterable<? extends T> elements)

Implements org.eclipse.collections.api.bag.sorted.ImmutableSortedBag.newWithAll, org.eclipse.collections.api.collection.ImmutableCollection.newWithAll.

This method is similar to the withAll method in MutableCollection with the difference that a new copy of this collection with the elements appended will be returned.

public ImmutableSortedBag<T>
newWithout(T element)

Implements org.eclipse.collections.api.bag.sorted.ImmutableSortedBag.newWithout, org.eclipse.collections.api.collection.ImmutableCollection.newWithout.

This method is similar to the without method in MutableCollection with the difference that a new copy of this collection with the element removed will be returned.

public boolean
noneSatisfy(Predicate<? super T> predicate)

Overrides org.eclipse.collections.impl.AbstractRichIterable.noneSatisfy.

Implements org.eclipse.collections.api.RichIterable.noneSatisfy.

Returns true if the predicate evaluates to false for every element of the iterable or if the iterable is empty.

public <P> boolean
noneSatisfyWith(Predicate2<? super T, ? super P> predicate, P parameter)

Overrides org.eclipse.collections.impl.AbstractRichIterable.noneSatisfyWith.

Implements org.eclipse.collections.api.RichIterable.noneSatisfyWith.

Returns true if the predicate evaluates to false for every element of the collection, or return false.

public boolean
noneSatisfyWithOccurrences(ObjectIntPredicate<? super T> predicate)

Implements org.eclipse.collections.api.bag.Bag.noneSatisfyWithOccurrences.

Returns true if the Bag is empty or if the predicate evaluates to false for all elements of the Bag.

public int
occurrencesOf(Object item)

Implements org.eclipse.collections.api.bag.Bag.occurrencesOf.

The occurrences of a distinct item in the bag.

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

Implements org.eclipse.collections.api.bag.sorted.SortedBag.partitionWhile.

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

public int
size()

Implements org.eclipse.collections.api.RichIterable.size, java.util.Collection.size.

Returns the number of items in this iterable.

public int
sizeDistinct()

Implements org.eclipse.collections.api.bag.Bag.sizeDistinct.

The size of the Bag when counting only distinct elements.

public ImmutableSortedBag<T>
take(int count)

Implements org.eclipse.collections.api.bag.sorted.ImmutableSortedBag.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 ImmutableSortedBag<T>
takeWhile(Predicate<? super T> predicate)

Implements org.eclipse.collections.api.bag.sorted.ImmutableSortedBag.takeWhile.

Returns the initial elements that satisfy the Predicate.

public Object[]
public <E> E[]
toArray(E[] array)

Overrides org.eclipse.collections.impl.bag.AbstractBag.toArray.

Overrides default org.eclipse.collections.api.RichIterable.toArray.

Implements java.util.Collection.toArray.

Converts this iterable to an array using the specified target array, assuming the target array is as long or longer than the iterable.

public MutableSortedMap<T, Integer>
public MutableList<T>
toSortedList()

Overrides default org.eclipse.collections.api.RichIterable.toSortedList.

Converts the collection to a MutableList implementation and sorts it using the natural order of the elements.

public MutableSortedSet<T>
toSortedSet()

Overrides org.eclipse.collections.impl.bag.AbstractBag.toSortedSet.

Implements org.eclipse.collections.api.RichIterable.toSortedSet.

Converts the collection to a MutableSortedSet implementation and sorts it using the natural order of the elements.

public MutableSortedSet<T>
toSortedSet(Comparator<? super T> comparator)

Overrides org.eclipse.collections.impl.bag.AbstractBag.toSortedSet.

Implements org.eclipse.collections.api.RichIterable.toSortedSet.

Converts the collection to a MutableSortedSet implementation and sorts it using the specified comparator.

Inherited from org.eclipse.collections.impl.bag.sorted.immutable.AbstractImmutableSortedBag:
bottomOccurrenceschunkcollectcollectBooleancollectBytecollectCharcollectDoublecollectFloatcollectIfcollectIntcollectLongcollectShortcollectWithcollectWithOccurrencescountBycountByEachcountByWithdetectLastIndexflatCollectgroupBygroupByEachgroupByUniqueKeynewWithoutAllpartitionpartitionWithrejectrejectWithselectselectByOccurrencesselectInstancesOfselectWithtaptoImmutabletopOccurrencestoReversedwriteReplacezipzipzipWithIndex