A bag is like a set, except that elements can occur multiple times.
Complete the Bag
class. When adding an element that is already present, increment the counter. Otherwise, add it to the head of the linked list. When removing, decrement the counter and remove the node if it has reached zero.
The contains
method yields the number of times that the element is present.
The toString
method lists each element as often as it occurs in the list. See the JUnit test for the format.
Draft: Only provide add
and contains
.