TreeMultiset<E> Class

Definition

A multiset which maintains the ordering of its elements, according to either their natural order or an explicit Comparator. In all cases, this implementation uses Comparable#compareTo or Comparator#compare instead of Object#equals to determine equivalence of instances.

Warning: The comparison must be consistent with equals as explained by the Comparable class specification. Otherwise, the resulting multiset will violate the java.util.Collection contract, which is specified in terms of Object#equals.

See the Guava User Guide article on Multiset.

public final class TreeMultiset<E> extends AbstractSortedMultiset<E> implements Serializable

Type Parameters

E
Inheritance
java.lang.Object
java.util.AbstractCollection
com.azure.cosmos.implementation.guava25.collect.AbstractMultiset
com.azure.cosmos.implementation.guava25.collect.AbstractSortedMultiset
TreeMultiset<E>
Implements
java.io.Serializable

Inherited Members

com.azure.cosmos.implementation.guava25.collect.AbstractMultiset.add(E) com.azure.cosmos.implementation.guava25.collect.AbstractMultiset.add(E,int) com.azure.cosmos.implementation.guava25.collect.AbstractMultiset.addAll(java.util.Collection<? extends E>) com.azure.cosmos.implementation.guava25.collect.AbstractMultiset.clear() com.azure.cosmos.implementation.guava25.collect.AbstractMultiset.contains(java.lang.Object) com.azure.cosmos.implementation.guava25.collect.AbstractMultiset.entrySet() com.azure.cosmos.implementation.guava25.collect.AbstractMultiset.equals(java.lang.Object) com.azure.cosmos.implementation.guava25.collect.AbstractMultiset.hashCode() com.azure.cosmos.implementation.guava25.collect.AbstractMultiset.isEmpty() com.azure.cosmos.implementation.guava25.collect.AbstractMultiset.remove(java.lang.Object) com.azure.cosmos.implementation.guava25.collect.AbstractMultiset.remove(java.lang.Object,int) com.azure.cosmos.implementation.guava25.collect.AbstractMultiset.removeAll(java.util.Collection<?>) com.azure.cosmos.implementation.guava25.collect.AbstractMultiset.retainAll(java.util.Collection<?>) com.azure.cosmos.implementation.guava25.collect.AbstractMultiset.setCount(E,int) com.azure.cosmos.implementation.guava25.collect.AbstractMultiset.setCount(E,int,int) com.azure.cosmos.implementation.guava25.collect.AbstractMultiset.toString() com.azure.cosmos.implementation.guava25.collect.AbstractSortedMultiset.comparator() com.azure.cosmos.implementation.guava25.collect.AbstractSortedMultiset.descendingMultiset() com.azure.cosmos.implementation.guava25.collect.AbstractSortedMultiset.elementSet() com.azure.cosmos.implementation.guava25.collect.AbstractSortedMultiset.firstEntry() com.azure.cosmos.implementation.guava25.collect.AbstractSortedMultiset.lastEntry() com.azure.cosmos.implementation.guava25.collect.AbstractSortedMultiset.pollFirstEntry() com.azure.cosmos.implementation.guava25.collect.AbstractSortedMultiset.pollLastEntry() com.azure.cosmos.implementation.guava25.collect.AbstractSortedMultiset.subMultiset(E,com.azure.cosmos.implementation.guava25.collect.BoundType,E,com.azure.cosmos.implementation.guava25.collect.BoundType) java.lang.Object.clone() java.lang.Object.finalize() java.lang.Object.getClass() java.lang.Object.notify() java.lang.Object.notifyAll() java.lang.Object.wait() java.lang.Object.wait(long) java.lang.Object.wait(long,int) java.util.AbstractCollection.<T>toArray(T[]) java.util.AbstractCollection.containsAll(java.util.Collection<?>) java.util.AbstractCollection.iterator() java.util.AbstractCollection.size() java.util.AbstractCollection.toArray()

Methods

<E>create()

Creates a new, empty multiset, sorted according to the elements' natural order. All elements inserted into the multiset must implement the Comparable interface. Furthermore, all such elements must be mutually comparable: e1.compareTo(e2) must not throw a ClassCastException for any elements e1 and e2 in the multiset. If the user attempts to add an element to the multiset that violates this constraint (for example, the user attempts to add a string element to a set whose elements are integers), the add(Object) call will throw a ClassCastException.

The type specification is ``, instead of the more specific >, to support classes defined without generics.

<E>create(Iterable<? extends E> elements)

Creates an empty multiset containing the given initial elements, sorted according to the elements' natural order.

This implementation is highly efficient when elements is itself a Multiset<E>.

The type specification is ``, instead of the more specific >, to support classes defined without generics.

<E>create(Comparator<? super E> comparator)

Creates a new, empty multiset, sorted according to the specified comparator. All elements inserted into the multiset must be mutually comparable by the specified comparator: comparator.compare(e1, e2) must not throw a ClassCastException for any elements e1 and e2 in the multiset. If the user attempts to add an element to the multiset that violates this constraint, the add(Object) call will throw a ClassCastException.

add(E element, int occurrences)

Adds a number of occurrences of an element to this multiset. Note that if occurrences == 1, this method has the identical effect to add. This method is functionally equivalent (except in the case of overflow) to the call addAll(Collections.nCopies(element, occurrences)), which would presumably perform much more poorly.

clear()
count(Object element)
forEachEntry(ObjIntConsumer<? super E> action)
headMultiset(E upperBound, BoundType boundType)
iterator()
remove(Object element, int occurrences)

Removes a number of occurrences of the specified element from this multiset. If the multiset contains fewer than this number of occurrences to begin with, all occurrences will be removed. Note that if occurrences == 1, this is functionally equivalent to the call remove(element).

setCount(E element, int count)

Adds or removes the necessary occurrences of an element such that the element attains the desired count.

setCount(E element, int oldCount, int newCount)

Conditionally sets the count of an element to a new value, as described in setCount, provided that the element has the expected current count. If the current count is not oldCount, no change is made.

size()
tailMultiset(E lowerBound, BoundType boundType)

Applies to