java - Sparse Map with Enum keys -
i need create map enum keys small fraction of enum constants inserted. best approach? enummap inefficient if length of underlying array equal total number of enum constants.
i suggest using ordinary hashmap
.
computing hashes enums both easy , cheap. there should no significant memory overhead, since not duplicating enum objects, instead creating multiple references same object. reason, there should little difference between storing integer key , storing reference enum object.