When all the keys of a Map are values from the same enum, the ``++Map++`` can be replaced with an ``++EnumMap++``, which can be much more efficient than other sets because the underlying data structure is a simple array. == Noncompliant Code Example [source,java] ---- public class MyClass { public enum COLOR { RED, GREEN, BLUE, ORANGE; } public void mapMood() { Map moodMap = new HashMap (); } } ---- == Compliant Solution [source,java] ---- public class MyClass { public enum COLOR { RED, GREEN, BLUE, ORANGE; } public void mapMood() { EnumMap moodMap = new EnumMap<> (COLOR.class); } } ---- ifdef::env-github,rspecator-view[] ''' == Implementation Specification (visible only on this page) include::message.adoc[] endif::env-github,rspecator-view[]