Class TreeBag<T>
java.lang.Object
org.eclipse.collections.impl.AbstractRichIterable<T>
org.eclipse.collections.impl.bag.AbstractBag<T>
org.eclipse.collections.impl.bag.mutable.AbstractMutableBagIterable<T>
org.eclipse.collections.impl.bag.sorted.mutable.AbstractMutableSortedBag<T>
org.eclipse.collections.impl.bag.sorted.mutable.TreeBag<T>
- All Implemented Interfaces:
Externalizable,Serializable,Cloneable,Comparable<SortedBag<T>>,Iterable<T>,Collection<T>,Bag<T>,MutableBagIterable<T>,MutableSortedBag<T>,SortedBag<T>,MutableCollection<T>,InternalIterable<T>,OrderedIterable<T>,ReversibleIterable<T>,SortedIterable<T>,RichIterable<T>
A TreeBag is a MutableSortedBag which uses a SortedMap as its underlying data store. Each key in the SortedMap represents some item,
and the value in the map represents the current number of occurrences of that item.
- Since:
- 4.2
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanintaddOccurrences(T item, int occurrences) booleanallSatisfyWithOccurrences(ObjectIntPredicate<? super T> predicate) booleananySatisfyWithOccurrences(ObjectIntPredicate<? super T> predicate) voidclear()clone()Comparator<? super T>intboolean<S> booleancorresponds(OrderedIterable<S> other, Predicate2<? super T, ? super S> predicate) intdetectIndex(Predicate<? super T> predicate) detectWithOccurrences(ObjectIntPredicate<? super T> predicate) distinct()drop(int count) voidbooleanvoid<P> voidforEachWith(Procedure2<? super T, ? super P> procedure, P parameter) voidforEachWithIndex(int fromIndex, int toIndex, ObjectIntProcedure<? super T> objectIntProcedure) voidforEachWithIndex(ObjectIntProcedure<? super T> objectIntProcedure) voidforEachWithOccurrences(ObjectIntProcedure<? super T> procedure) <V> TreeBagMultimap<V,T> <V> TreeBagMultimap<V,T> groupByEach(Function<? super T, ? extends Iterable<V>> function) inthashCode()intbooleanisEmpty()iterator()static <E> TreeBag<E>newBag()static <E> TreeBag<E>static <E> TreeBag<E>newBag(Comparator<? super E> comparator) static <E> TreeBag<E>newBag(Comparator<? super E> comparator, Iterable<? extends E> iterable) static <E> TreeBag<E>newBagWith(E... elements) static <E> TreeBag<E>newBagWith(Comparator<? super E> comparator, E... elements) newEmpty()booleannoneSatisfyWithOccurrences(ObjectIntPredicate<? super T> predicate) intoccurrencesOf(Object item) voidbooleanbooleanremoveAllIterable(Iterable<?> iterable) boolean<P> booleanremoveIfWith(Predicate2<? super T, ? super P> predicate, P parameter) booleanremoveOccurrences(Object item, int occurrences) selectByOccurrences(IntPredicate predicate) booleansetOccurrences(T item, int occurrences) intsize()inttake(int count) toStack()withoutAll(Iterable<? extends T> iterable) voidMethods inherited from class org.eclipse.collections.impl.bag.sorted.mutable.AbstractMutableSortedBag
asParallel, asSynchronized, asUnmodifiable, collect, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectIf, collectInt, collectLong, collectShort, collectWith, collectWithIndex, collectWithIndex, collectWithOccurrences, countBy, countByEach, countByWith, detectLastIndex, dropWhile, flatCollect, partition, partitionWhile, partitionWith, reject, rejectWith, select, selectInstancesOf, selectWith, takeWhile, tap, toImmutable, toMapOfItemToCount, toReversed, zipMethods inherited from class org.eclipse.collections.impl.bag.mutable.AbstractMutableBagIterable
addAll, addAllIterable, allSatisfy, allSatisfyWith, anySatisfy, anySatisfyWith, bottomOccurrences, chunk, detect, detectIfNone, detectOptional, detectWith, detectWithIfNone, detectWithOptional, getFirst, getLast, groupByUniqueKey, max, max, maxBy, min, min, minBy, noneSatisfy, noneSatisfyWith, removeAll, retainAll, retainAllIterable, selectAndRejectWith, sumByDouble, sumByFloat, sumByInt, sumByLong, topOccurrencesMethods inherited from class org.eclipse.collections.impl.bag.AbstractBag
collect, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectIf, collectInt, collectLong, collectShort, collectWith, count, flatCollect, flatCollectBoolean, flatCollectByte, flatCollectChar, flatCollectDouble, flatCollectFloat, flatCollectInt, flatCollectLong, flatCollectShort, groupBy, groupByEach, injectInto, injectInto, injectInto, injectInto, injectInto, injectIntoWith, reject, rejectWith, select, selectWith, sumOfDouble, sumOfFloat, sumOfInt, sumOfLong, toArray, toArray, toBag, toList, toSet, toSortedBag, toSortedBag, toSortedList, toSortedSet, toSortedSet, toStringOfItemToCountMethods inherited from class org.eclipse.collections.impl.AbstractRichIterable
appendString, appendString, asLazy, containsAll, containsAllArguments, containsAllIterable, countWith, forEach, groupByUniqueKey, into, toBiMap, toMap, toSortedBagBy, toSortedListBy, toSortedMap, toSortedMap, toSortedMapBy, toSortedSetBy, toString, zip, zipWithIndexMethods inherited from interface org.eclipse.collections.api.bag.Bag
aggregateBy, collectWithOccurrences, reduceBy, reduceInPlace, reduceInPlace, summarizeDouble, summarizeFloat, summarizeInt, summarizeLong, toStringOfItemToCountMethods inherited from interface java.util.Collection
addAll, containsAll, parallelStream, removeAll, removeIf, retainAll, spliterator, stream, toArrayMethods inherited from interface org.eclipse.collections.api.InternalIterable
forEachMethods inherited from interface org.eclipse.collections.api.bag.MutableBagIterable
bottomOccurrences, selectDuplicates, selectUnique, topOccurrencesMethods inherited from interface org.eclipse.collections.api.collection.MutableCollection
addAllIterable, aggregateBy, aggregateInPlaceBy, flatCollectWith, groupByUniqueKey, injectIntoWith, retainAllIterable, selectAndRejectWith, sumByDouble, sumByFloat, sumByInt, sumByLong, toArray, toArrayMethods inherited from interface org.eclipse.collections.api.bag.sorted.MutableSortedBag
flatCollectWith, selectDuplicates, selectUnique, toImmutableSortedBag, withOccurrences, withoutOccurrencesMethods inherited from interface org.eclipse.collections.api.ordered.OrderedIterable
getFirst, getFirstOptional, getLast, getLastOptional, rejectWithIndex, selectWithIndex, zip, zipWithIndexMethods inherited from interface org.eclipse.collections.api.ordered.ReversibleIterable
asReversed, reverseForEach, reverseForEachWithIndexMethods inherited from interface org.eclipse.collections.api.RichIterable
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, makeString, makeString, makeString, makeString, max, maxBy, maxByOptional, maxOptional, maxOptional, min, minBy, minByOptional, minOptional, minOptional, noneSatisfy, noneSatisfyWith, notEmpty, reduce, reduceBy, reject, rejectWith, select, selectWith, sumOfDouble, sumOfFloat, sumOfInt, sumOfLong, toArray, toArray, toBag, toBiMap, toImmutableBag, toImmutableBiMap, toImmutableList, toImmutableMap, toImmutableSet, toImmutableSortedBag, toImmutableSortedBagBy, toImmutableSortedList, toImmutableSortedList, toImmutableSortedListBy, toImmutableSortedSet, toImmutableSortedSet, toImmutableSortedSetBy, toList, toMap, toMap, toSet, toSortedBag, toSortedBag, toSortedBagBy, toSortedList, toSortedList, toSortedListBy, toSortedMap, toSortedMap, toSortedMapBy, toSortedSet, toSortedSet, toSortedSetBy, toString
-
Constructor Details
-
TreeBag
public TreeBag() -
TreeBag
-
TreeBag
-
TreeBag
-
-
Method Details
-
newBag
-
newBag
-
newBag
-
newBag
public static <E> TreeBag<E> newBag(Comparator<? super E> comparator, Iterable<? extends E> iterable) -
newBagWith
-
newBagWith
-
clone
- Specified by:
clonein interfaceMutableSortedBag<T>- Specified by:
clonein classAbstractMutableSortedBag<T>
-
equals
-
hashCode
public int hashCode() -
sizeDistinct
public int sizeDistinct()- Specified by:
sizeDistinctin interfaceBag<T>
-
forEachWithOccurrences
- Specified by:
forEachWithOccurrencesin interfaceBag<T>
-
selectByOccurrences
- Specified by:
selectByOccurrencesin interfaceBag<T>- Specified by:
selectByOccurrencesin interfaceMutableBagIterable<T>- Specified by:
selectByOccurrencesin interfaceMutableSortedBag<T>- Specified by:
selectByOccurrencesin interfaceSortedBag<T>
-
occurrencesOf
- Specified by:
occurrencesOfin interfaceBag<T>
-
anySatisfyWithOccurrences
- Specified by:
anySatisfyWithOccurrencesin interfaceBag<T>
-
allSatisfyWithOccurrences
- Specified by:
allSatisfyWithOccurrencesin interfaceBag<T>
-
noneSatisfyWithOccurrences
- Specified by:
noneSatisfyWithOccurrencesin interfaceBag<T>
-
detectWithOccurrences
- Specified by:
detectWithOccurrencesin interfaceBag<T>
-
isEmpty
public boolean isEmpty()- Specified by:
isEmptyin interfaceCollection<T>- Specified by:
isEmptyin interfaceRichIterable<T>- Overrides:
isEmptyin classAbstractRichIterable<T>
-
remove
- Specified by:
removein interfaceCollection<T>
-
clear
public void clear()- Specified by:
clearin interfaceCollection<T>
-
contains
- Specified by:
containsin interfaceCollection<T>- Specified by:
containsin interfaceRichIterable<T>- Overrides:
containsin classAbstractRichIterable<T>
-
compareTo
- Specified by:
compareToin interfaceComparable<T>
-
writeExternal
- Specified by:
writeExternalin interfaceExternalizable- Throws:
IOException
-
readExternal
- Specified by:
readExternalin interfaceExternalizable- Throws:
IOExceptionClassNotFoundException
-
each
- Specified by:
eachin interfaceRichIterable<T>
-
forEachWithIndex
- Specified by:
forEachWithIndexin interfaceInternalIterable<T>- Specified by:
forEachWithIndexin interfaceOrderedIterable<T>- Overrides:
forEachWithIndexin classAbstractRichIterable<T>
-
forEach
- Specified by:
forEachin interfaceOrderedIterable<T>
-
forEachWithIndex
public void forEachWithIndex(int fromIndex, int toIndex, ObjectIntProcedure<? super T> objectIntProcedure) - Specified by:
forEachWithIndexin interfaceOrderedIterable<T>
-
forEachWith
- Specified by:
forEachWithin interfaceInternalIterable<T>- Overrides:
forEachWithin classAbstractRichIterable<T>
-
iterator
-
addOccurrences
- Specified by:
addOccurrencesin interfaceMutableBagIterable<T>
-
removeOccurrences
- Specified by:
removeOccurrencesin interfaceMutableBagIterable<T>
-
setOccurrences
- Specified by:
setOccurrencesin interfaceMutableBagIterable<T>
-
without
- Specified by:
withoutin interfaceMutableBagIterable<T>- Specified by:
withoutin interfaceMutableCollection<T>- Specified by:
withoutin interfaceMutableSortedBag<T>
-
withAll
- Specified by:
withAllin interfaceMutableBagIterable<T>- Specified by:
withAllin interfaceMutableCollection<T>- Specified by:
withAllin interfaceMutableSortedBag<T>
-
withoutAll
- Specified by:
withoutAllin interfaceMutableBagIterable<T>- Specified by:
withoutAllin interfaceMutableCollection<T>- Specified by:
withoutAllin interfaceMutableSortedBag<T>
-
with
- Specified by:
within interfaceMutableBagIterable<T>- Specified by:
within interfaceMutableCollection<T>- Specified by:
within interfaceMutableSortedBag<T>
-
newEmpty
- Specified by:
newEmptyin interfaceMutableCollection<T>- Specified by:
newEmptyin interfaceMutableSortedBag<T>
-
removeIf
- Specified by:
removeIfin interfaceMutableCollection<T>
-
removeIfWith
- Specified by:
removeIfWithin interfaceMutableCollection<T>
-
removeAllIterable
- Specified by:
removeAllIterablein interfaceMutableCollection<T>
-
size
public int size()- Specified by:
sizein interfaceCollection<T>- Specified by:
sizein interfaceRichIterable<T>
-
indexOf
- Specified by:
indexOfin interfaceOrderedIterable<T>
-
zipWithIndex
- Specified by:
zipWithIndexin interfaceBag<T>- Specified by:
zipWithIndexin interfaceMutableBagIterable<T>- Specified by:
zipWithIndexin interfaceMutableCollection<T>- Specified by:
zipWithIndexin interfaceMutableSortedBag<T>- Specified by:
zipWithIndexin interfaceOrderedIterable<T>- Specified by:
zipWithIndexin interfaceReversibleIterable<T>- Specified by:
zipWithIndexin interfaceRichIterable<T>- Specified by:
zipWithIndexin interfaceSortedBag<T>- Specified by:
zipWithIndexin interfaceSortedIterable<T>
-
distinct
- Specified by:
distinctin interfaceMutableSortedBag<T>- Specified by:
distinctin interfaceOrderedIterable<T>- Specified by:
distinctin interfaceReversibleIterable<T>- Specified by:
distinctin interfaceSortedBag<T>- Specified by:
distinctin interfaceSortedIterable<T>
-
groupBy
- Specified by:
groupByin interfaceBag<T>- Specified by:
groupByin interfaceMutableBagIterable<T>- Specified by:
groupByin interfaceMutableCollection<T>- Specified by:
groupByin interfaceMutableSortedBag<T>- Specified by:
groupByin interfaceOrderedIterable<T>- Specified by:
groupByin interfaceReversibleIterable<T>- Specified by:
groupByin interfaceRichIterable<T>- Specified by:
groupByin interfaceSortedBag<T>- Specified by:
groupByin interfaceSortedIterable<T>
-
groupByEach
- Specified by:
groupByEachin interfaceBag<T>- Specified by:
groupByEachin interfaceMutableBagIterable<T>- Specified by:
groupByEachin interfaceMutableCollection<T>- Specified by:
groupByEachin interfaceMutableSortedBag<T>- Specified by:
groupByEachin interfaceOrderedIterable<T>- Specified by:
groupByEachin interfaceReversibleIterable<T>- Specified by:
groupByEachin interfaceRichIterable<T>- Specified by:
groupByEachin interfaceSortedBag<T>- Specified by:
groupByEachin interfaceSortedIterable<T>
-
detectIndex
- Specified by:
detectIndexin interfaceOrderedIterable<T>
-
corresponds
- Specified by:
correspondsin interfaceOrderedIterable<T>
-
toStack
- Specified by:
toStackin interfaceOrderedIterable<T>
-
take
- Specified by:
takein interfaceMutableSortedBag<T>- Specified by:
takein interfaceReversibleIterable<T>- Specified by:
takein interfaceSortedBag<T>
-
drop
- Specified by:
dropin interfaceMutableSortedBag<T>- Specified by:
dropin interfaceReversibleIterable<T>- Specified by:
dropin interfaceSortedBag<T>
-
comparator
- Specified by:
comparatorin interfaceSortedBag<T>- Specified by:
comparatorin interfaceSortedIterable<T>
-
with
-
with
-
add
- Specified by:
addin interfaceCollection<T>
-
with
-
distinctView
- Specified by:
distinctViewin interfaceBag<T>
-