org.apache.commons.collections

Class TreeBag

Implemented Interfaces:
Bag, Collection, Bag, SortedBag

public class TreeBag
extends DefaultMapBag
implements SortedBag, Bag

An implementation of Bag that is backed by a TreeMap. Order will be maintained among the unique representative members.
Author:
Chuck Burdick
Since:
2.0

Constructor Summary

TreeBag()
Constructs a new empty TreeBag.
TreeBag(Collection c)
New Bag containing all the members of the given collection.
TreeBag(Comparator c)
New Bag that maintains order on its unique representative members according to the given Comparator.

Method Summary

Comparator
comparator()
Object
first()
Object
last()

Methods inherited from class org.apache.commons.collections.DefaultMapBag

add, add, addAll, calcTotalSize, clear, contains, containsAll, containsAll, equals, getCount, getMap, hashCode, isEmpty, iterator, remove, remove, removeAll, retainAll, retainAll, setMap, size, toArray, toArray, toString, uniqueSet

Constructor Details

TreeBag

public TreeBag()
Constructs a new empty TreeBag.

TreeBag

public TreeBag(Collection c)
New Bag containing all the members of the given collection.
See Also:
TreeBag

TreeBag

public TreeBag(Comparator c)
New Bag that maintains order on its unique representative members according to the given Comparator.

Method Details

comparator

public Comparator comparator()
Specified by:
comparator in interface SortedBag

first

public Object first()
Specified by:
first in interface SortedBag

last

public Object last()
Specified by:
last in interface SortedBag

Copyright © 2001-2004 Apache Software Foundation. Documenation generated ${TODAY}.