+ Start a Discussion
d3developerd3developer 

Using Map with Enum ?

So, I tried to use a map with an Enum object (which I am told I can use as a datatype in the documentation), but it does not work.

 

 

Declaration in the class definition:

 

public enum Season {WINTER, SPRING}

 

Definition of Map in the constructor:

 

 

Map<Season,String> heatMap = new Map<Season,String> ();

 

 Error:

 

 

 

 

 

Error: Compile Error: Map by CustomCon.Season not allowed at line 27 column 37

 






 

anschoeweanschoewe

I have experienced the same issue.  Does anyone know if there is a solution to this?  Clearly enums are not just another datatype if this doesn't work.

 

Does anyone have any work-arounds for such a scenario?

 

Andrew

loneboatloneboat

I'd be interested in an answer to this as well.