Is there a more efficient and specialized implementation of a Map collection where Enum objects can serve as keys?
I learned this recently after I accidentally stumbled upon the answer in the Java API. If you ever have a map that uses enums as keys make sure you use EnumMap. It's very simple and much more efficient:
public interface LibraryItem{ ... }
public enum LibraryItemType{ BOOK, CD, VHS, AUDIO; ... }
Map> itemsByType =
new EnumMap<>(LibraryItemType.class);