It's much faster to simply iterate over the few items in the enumeration instead of looking them up in a map, especially since classes can be compared by identity instead of using the hashcode.