Is there a corresponding immutable enumMap in guava?

Guava contributor here. Guava doesn’t currently have an ImmutableEnumMap variant, but if it did, it would probably just be a wrapper around an EnumMap. (That said, slightly better immutable implementations are possible.) EnumMap will perform better than the basic ImmutableMap, in any event; it’s difficult or impossible to beat. (I’ll file an issue to investigate … Read more

Why use EnumMap instead of HashMap

The Javadoc makes a pretty good argument: Enum maps are represented internally as arrays. This representation is extremely compact and efficient. Implementation note: All basic operations execute in constant time. They are likely (though not guaranteed) to be faster than their HashMap counterparts.

tech