I suspect that History
is an enum
. Otherwise you will have a bound-type error.
If the History
type is an enum
, then the root of your problem is in the public EnumMap (Class< K > keyType) constructor, because as per javadoc, it:
Creates an empty enum map with the specified key type.
In your case, you're defining that the key type will be History
and in the meantime you're passing an Enum.class
to the constructor.
A valid definition would be:
new EnumMap<History, String>(History.class);