guava icon indicating copy to clipboard operation
guava copied to clipboard

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

Open Yuukiko85 opened this issue 3 years ago • 3 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.

Yuukiko85 avatar Aug 04 '22 21:08 Yuukiko85

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

chaoren avatar Aug 08 '22 18:08 chaoren

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

Yuukiko85 avatar Aug 09 '22 21:08 Yuukiko85

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.

lowasser avatar Aug 09 '22 22:08 lowasser