HashBag is a collection that knows the number of times an object appears in it. HashBag described here is an apache collection class. HashBag internally depends on HashMap. The Object to store becomes they Key and the no. of copies becomes the Value.
HashBag internally uses HashMap where the Object is the key and its value, a Mutable Integer to keep track of the count of objects in the collection.