google / guava

Google core libraries for Java

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Make CompactHashMap and CompactLinkedHashMap public or add it to Maps utility class

Yuukiko85 opened this issue · comments

Currently, you can't call the public CompactHashMap.create() or CompactHashMap.createWithInitialSize() methods (or the CompactLinkedHashMap variants) because the classes themselves are private.

In order to use the classes, I think they should either be made public, or the Maps utility class should be able to return instances of these.

Or maybe there is a way and I've just overlooked it.

I think CompactHashMap only exists as implementation detail for Multimaps and wasn't meant to be used directly.

The comments seem to imply it could be used directly if there is a use case for it.

It was a deliberate choice not to expose these for public use. It wasn't clear we wanted to get into the business of "alternate collection implementations for different performance goals, not different semantic goals e.g. Multimaps or immutable collections."

It may be appropriate to change that decision based on new data, but it was intentional.