Top Description Fields Constructors Methods
org.eclipse.collections.impl.bag.sorted.mutable

public Class SynchronizedSortedBag<T>

extends AbstractSynchronizedMutableCollection<T>
implements MutableSortedBag<T>, Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable, org.eclipse.collections.api.bag.sorted.MutableSortedBag, java.lang.Cloneable, org.eclipse.collections.api.bag.MutableBagIterable, org.eclipse.collections.api.collection.MutableCollection, org.eclipse.collections.api.RichIterable, org.eclipse.collections.api.InternalIterable, java.lang.Iterable, java.util.Collection, org.eclipse.collections.api.bag.Bag, org.eclipse.collections.api.bag.sorted.SortedBag, org.eclipse.collections.api.ordered.ReversibleIterable, org.eclipse.collections.api.ordered.OrderedIterable, org.eclipse.collections.api.ordered.SortedIterable, java.lang.Comparable
Imports
java.io.Serializable, java.util.Collection, .Collections, .Comparator, .Optional, java.util.concurrent.ExecutorService, org.eclipse.collections.api.RichIterable, org.eclipse.collections.api.bag.ParallelBag, org.eclipse.collections.api.bag.sorted.ImmutableSortedBag, .MutableSortedBag, .SortedBag, 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, .ObjectIntPredicate, org.eclipse.collections.api.block.procedure.Procedure, org.eclipse.collections.api.block.procedure.primitive.ObjectIntProcedure, org.eclipse.collections.api.list.MutableList, org.eclipse.collections.api.list.primitive.MutableBooleanList, .MutableByteList, .MutableCharList, .MutableDoubleList, .MutableFloatList, .MutableIntList, .MutableLongList, .MutableShortList, org.eclipse.collections.api.map.sorted.MutableSortedMap, org.eclipse.collections.api.multimap.sortedbag.MutableSortedBagMultimap, org.eclipse.collections.api.ordered.OrderedIterable, org.eclipse.collections.api.partition.bag.sorted.PartitionMutableSortedBag, org.eclipse.collections.api.set.sorted.MutableSortedSet, org.eclipse.collections.api.stack.MutableStack, org.eclipse.collections.api.tuple.Pair, org.eclipse.collections.api.tuple.primitive.ObjectIntPair, org.eclipse.collections.impl.SynchronizedRichIterable, org.eclipse.collections.impl.collection.mutable.AbstractSynchronizedMutableCollection, .SynchronizedCollectionSerializationProxy, org.eclipse.collections.impl.stack.mutable.ArrayStack

A synchronized view of a MutableSortedBag. It is imperative that the user manually synchronize on the collection when iterating over it using the standard JDK iterator or JDK 5 for loop, as per Collections#synchronizedCollection(Collection).
See Also
MutableSortedBag#asSynchronized()

Field Summary

Modifier and TypeField and Description
private static final long

Constructor Summary

AccessConstructor and Description
pack-priv
pack-priv

Method Summary

Modifier and TypeMethod and Description
public int
addOccurrences(T item, int occurrences)

Implements org.eclipse.collections.api.bag.MutableBagIterable.addOccurrences.

Add number of occurrences for an item.

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
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 ParallelBag<T>
asParallel(ExecutorService executorService, int batchSize)

public MutableSortedBag<T>
public MutableSortedBag<T>
public MutableList<ObjectIntPair<T>>
public MutableSortedBag<T>
clone()

Overrides java.lang.Object.clone.

Implements org.eclipse.collections.api.bag.sorted.MutableSortedBag.clone.

Creates and returns a copy of this object.

public <V> MutableList<V>
public MutableBooleanList
public MutableByteList
collectByte(ByteFunction<? super T> byteFunction)

Overrides org.eclipse.collections.impl.collection.mutable.AbstractSynchronizedMutableCollection.collectByte.

Overrides default org.eclipse.collections.api.collection.MutableCollection.collectByte.

Implements org.eclipse.collections.api.bag.sorted.MutableSortedBag.collectByte, org.eclipse.collections.api.RichIterable.collectByte.

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

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

Overrides org.eclipse.collections.impl.collection.mutable.AbstractSynchronizedMutableCollection.collectChar.

Overrides default org.eclipse.collections.api.collection.MutableCollection.collectChar.

Implements org.eclipse.collections.api.bag.sorted.MutableSortedBag.collectChar, org.eclipse.collections.api.RichIterable.collectChar.

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

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

Overrides org.eclipse.collections.impl.collection.mutable.AbstractSynchronizedMutableCollection.collectIf.

Implements org.eclipse.collections.api.bag.sorted.MutableSortedBag.collectIf, org.eclipse.collections.api.collection.MutableCollection.collectIf, org.eclipse.collections.api.RichIterable.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 MutableIntList
collectInt(IntFunction<? super T> intFunction)

Overrides org.eclipse.collections.impl.collection.mutable.AbstractSynchronizedMutableCollection.collectInt.

Overrides default org.eclipse.collections.api.collection.MutableCollection.collectInt.

Implements org.eclipse.collections.api.bag.sorted.MutableSortedBag.collectInt, org.eclipse.collections.api.RichIterable.collectInt.

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

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

Overrides org.eclipse.collections.impl.collection.mutable.AbstractSynchronizedMutableCollection.collectLong.

Overrides default org.eclipse.collections.api.collection.MutableCollection.collectLong.

Implements org.eclipse.collections.api.bag.sorted.MutableSortedBag.collectLong, org.eclipse.collections.api.RichIterable.collectLong.

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

public MutableShortList
public <P, V> MutableList<V>
public <V> MutableList<V>
collectWithIndex(ObjectIntToObjectFunction<? super T, ? extends V> function)

Overrides default org.eclipse.collections.api.bag.sorted.MutableSortedBag.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 <V> MutableList<V>
collectWithOccurrences(ObjectIntToObjectFunction<? super T, ? extends V> function)

Implements org.eclipse.collections.api.bag.sorted.MutableSortedBag.collectWithOccurrences.

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

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

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

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

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> o)

Implements java.lang.Comparable.compareTo.

Compares this object with the specified object for order.

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 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.

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

Implements org.eclipse.collections.api.ordered.ReversibleIterable.detectLastIndex.

Returns the index of the last element of the ReversibleIterable for which the predicate evaluates to true.

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 MutableSortedSet<T>
distinct()

Implements org.eclipse.collections.api.bag.sorted.MutableSortedBag.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 MutableSortedBag<T>
drop(int count)

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

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

Returns the final elements that do not satisfy the Predicate.

public <V> MutableList<V>
public void
forEach(int startIndex, int endIndex, 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(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.

protected MutableSortedBag<T>
public Optional<T>
getFirstOptional()

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

Returns the first element of an iterable as an Optional.

public Optional<T>
getLastOptional()

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

Returns the last element of an iterable as an Optional.

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

Overrides org.eclipse.collections.impl.collection.mutable.AbstractSynchronizedMutableCollection.groupBy.

Implements org.eclipse.collections.api.bag.sorted.MutableSortedBag.groupBy, org.eclipse.collections.api.collection.MutableCollection.groupBy, org.eclipse.collections.api.RichIterable.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> MutableSortedBagMultimap<V, T>
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 MutableSortedBag<T>
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 static <E> SynchronizedSortedBag<E>
public static <E> MutableSortedBag<E>
of(MutableSortedBag<E> bag, Object lock)

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

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

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

public <P> PartitionMutableSortedBag<T>
public MutableSortedBag<T>
public <P> MutableSortedBag<T>
public boolean
public void
reverseForEach(Procedure<? super T> procedure)

Overrides default org.eclipse.collections.api.ordered.ReversibleIterable.reverseForEach.

Evaluates the procedure for each element of the list iterating in reverse order.

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

Overrides default org.eclipse.collections.api.ordered.ReversibleIterable.reverseForEachWithIndex.

Evaluates the procedure for each element and it's index in reverse order.

public MutableSortedBag<T>
public MutableSortedBag<T>
selectByOccurrences(IntPredicate predicate)

Implements org.eclipse.collections.api.bag.sorted.MutableSortedBag.selectByOccurrences.

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

public <S> MutableSortedBag<S>
public MutableSortedSet<T>
selectUnique()

Overrides default org.eclipse.collections.api.bag.sorted.MutableSortedBag.selectUnique.

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

public <P> MutableSortedBag<T>
public boolean
public int
sizeDistinct()

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

The size of the Bag when counting only distinct elements.

public MutableSortedBag<T>
take(int count)

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

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

Returns the initial elements that satisfy the Predicate.

public MutableSortedBag<T>
public ImmutableSortedBag<T>
public MutableSortedMap<T, Integer>
toMapOfItemToCount()

Implements org.eclipse.collections.api.bag.sorted.MutableSortedBag.toMapOfItemToCount.

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

public MutableList<ObjectIntPair<T>>
public MutableSortedBag<T>
toReversed()

Implements org.eclipse.collections.api.bag.sorted.MutableSortedBag.toReversed.

Returns a new ReversibleIterable in reverse order.

public MutableStack<T>
toStack()

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

Converts the OrderedIterable to a mutable MutableStack implementation.

public String
toStringOfItemToCount()

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

Returns a string representation of this bag.

protected Object
public <S> MutableList<Pair<T, S>>
public MutableSortedSet<Pair<T, Integer>>
Inherited from org.eclipse.collections.impl.collection.mutable.AbstractSynchronizedMutableCollection:
addaddAlladdAllIterableaggregateByaggregateInPlaceByclearcountBycountByEachcountByWithgroupByUniqueKeyinjectIntoWithremoveremoveAllremoveAllIterableremoveIfremoveIfWithretainAllretainAllIterableselectAndRejectWithsumByDoublesumByFloatsumByIntsumByLong