Given that I have the requisite
import java.awt.Color;
import java.util.EnumMap;
and
enum Terrain { ... }
then as far as I can tell from the documentation, this should work
static EnumMap<Terrain, Color> colors = new EnumMap<Terrain, Color>(Terrain.class);
but it actually gives me this error
cannot find symbol
symbol : constructor EnumMap()
location: class java.util.EnumMap<Terrain,java.awt.Color>
static EnumMap<Terrain,Color>colors=new EnumMap<Terrain, Color>();
What am I missing?
The code the compiler is quoting doesn't match what you've claimed to have. It looks like you're not actually providing an argument to the constructor. This works fine, for example:
import java.util.EnumMap;
enum Foo {}
public class Test {
public static void main(String[] args) {
EnumMap<Foo, String> map = new EnumMap<Foo, String>(Foo.class);
}
}