I can't figure out why JCF (Java Collection Framework) does't have a Bag implementation(to allow duplicates and not maintain order).
Bag performance would be much better than current Collection implementations in JCF.
I know how to implement Bag in java.
I know there is a Bag collection in Apache common.
I know i can use any implementation as a bag! but there are so much work in other implementations compare to Bag.
Why has the Java Collections framework not provided direct implementations like this?
解决方案
Posting my comment as an answer since it answers this question best.
From the bug report filed here :
There isn't a lot of enthusiasm among the maintainers of the
Collection framework to design and implement these interfaces/classes.
I personally can't recall having needed one. It would be more likely
that a popular package developed outside the JDK would be imported
into the JDK after having proved its worth in the real world.
The need for having support for Bags is valid today.
Guava has support for it. Also GS-Collections.