Are you trying to declare a member variable named cells
? If so, the way to do it is:
public class Foo {
// ...
public Map<Type1, Type2> cells;
// ...
}
If you are trying to declare a variable within a method, do this:
public class Foo {
// ...
public void myMethod() {
// ...
Map<Type1, Type2> cells;
// ...
}
// ...
}
Edit: It looks like you are confused by Map <Key, Value>
, so I'll try to explain.
Key
is a placeholder for the data type that the Map
object will use for its set of keys. Similarly, Value
is a placeholder for the data type that it will use for its set of values. A valid combination would be, for example, Map <String, Integer>
. This means that the Map
object will map a set of String
objects to a set of Integer
objects.