please see the below code. This line is marked as incorrect by Eclipse:
var map = Map[MyEnum,Point]()
I am trying to do the scala equivalent of Java:
private enum Letters{ A,B,C}
private Map<Letters,Integer> thing= new HashMap<Letters,Integer> ();
And this is the file/context in which it is written.
class Point(var x:Int = 0, var y:Int = 0, var hasBeenSet:Boolean = false){
}
object MyEnum extends Enumeration{
MyEnum = Value
val UL,U,UR,L,R,DL,D,DR = Value
}
object MyEnumHolder {
var map = Map[MyEnum,Point]()
MyEnum.values.foreach(x => (map + (x -> new Point()) )
}
I am trying to initialize an instance of the map with each value of the enum mapped to an empty point (that's what is going on in the for each loop).
EDIT: Had to edit because I messed some things up editing the pasted code, but it should be valid now