public class TreeBag extends AbstractMapBag implements SortedBag, java.io.Serializable
SortedBag, using a
TreeMapto provide the data storage. This is the standard implementation of a sorted bag.
Order will be maintained among the bag members and can be viewed through the iterator.
Bag stores each object in the collection together with a
count of occurrences. Extra methods on the interface allow multiple copies
of an object to be added or removed at once. It is important to read the
interface javadoc carefully as several methods violate the
Collection interface specification.
|Constructor and Description|
Constructs an empty
Constructs an empty bag that maintains order on its unique representative members according to the given
|Modifier and Type||Method and Description|
Returns the comparator associated with this sorted set, or null if it uses its elements' natural ordering.
Returns the first (lowest) member.
Returns the last (highest) member.
add, add, addAll, clear, contains, containsAll, equals, getCount, hashCode, isEmpty, iterator, remove, remove, removeAll, retainAll, size, toArray, toArray, toString, uniqueSet
add, add, containsAll, getCount, iterator, remove, remove, removeAll, retainAll, size, uniqueSet
addAll, clear, contains, equals, hashCode, isEmpty, parallelStream, removeIf, spliterator, stream, toArray, toArray
public TreeBag(java.util.Comparator comparator)
comparator- the comparator to use
public TreeBag(java.util.Collection coll)
TreeBagcontaining all the members of the specified collection.
coll- the collection to copy into the bag
public java.lang.Object first()
public java.lang.Object last()
Copyright © 2010 - 2020 Adobe. All Rights Reserved