In the javadocs for Guava's ImmutableMap it says:
Performance notes: unlike HashMap, ImmutableMap is not optimized for element types that have slow Object.equals(java.lang.Object) or Object.hashCode() implementations. You can get better performance by having your element type cache its own hash codes, and by making use of the cached values to short-circuit a slow equals algorithm.
So my first question is how do I know if my element has a slow .equals or .hashCode implementation? In my specific instance, I'm using a java Enum as my key, so that has an efficient default implementation of .equals and .hashCode, right? (I assume the implementation of those for the values is irrelevant so long as you aren't accessing the map using the values' values.)
My second question is what does "having your element type cache its own hash codes" even mean! Googling around I couldn't seem to find an example of how you would do that. I assume maybe that means you end up with hashcodes within hashcodes? So I get into the hashcode bucket, and then the .equals methods uses a second set of hashcodes within that?