default methods inherited by EnumSet and EnumMap

Michael Hixson michael.hixson at
Tue Dec 6 08:03:54 UTC 2016


I notice that EnumSet and EnumMap don't override any of the default
methods that were added to collections in Java 8.  Were they
specifically considered then avoided during the Java 8 upgrades, or
was it simply that no one got around to optimizing them?  Are there
existing issues/bugs for optimizing them?  I couldn't find any.

As one example:  I suspect that EnumMap.forEach(action) could improve
a lot.  Right now it looks like iterating over keySet() and calling
get(key) is faster than forEach(action) when it comes to EnumMap
(unlike every other Map implementation I tested).


More information about the core-libs-dev mailing list