ABSTRACT

As with the tagged collections, the elements are organized based on an application-specified tag. However, in a tagged bucket collection, each tag maps a set of elements called a bucket. The semantics of put is modified to put a new bucket into the collection when the given tag is not yet in use. The new bucket is created by a bucket factory, which gives the application the flexibility to specify the collection type of the bucket. This can be done either by providing a bucket factory to the constructor, or by providing the constructor with a class to be instantiated when a new bucket is required. When the given tag is already in use, then the element is simply added to the existing bucket. Likewise, when an element is removed form a bucket of size 1, then the tag is also removed. In a tagged collection, the cost associated with locating a desired element generally depends on the number of tagged elements in the collection, whereas the cost associated with locating a desired element generally depends on the number of unique tags.