I need a data structure which works like the STL multiset but the TreeSet in Java doesn't allow duplicate elements. Is there any built-in data structure in Java which is equivalent to multiset ?
There is no Multiset in the standard Java libraries. You should use the Google Guava framework which contains Multiset classes. See