i’m new to java. I’m trying to pass parameters where a map is inside another map however i get an error “identifier expected”(found int, required reference).
This is the code :
package learning;
import java.util.*;
import java.text.SimpleDateFormat;
public interface Policy {
public void toggleApp(Map<Map<Appliance,SimpleDateFormat>,int>toggle); *error here*
}
class Appliance
{
String appName = "";
int appID;
double demand = 0.0;
}
You can’t provide primitive types (such as
int) as type parameters for generic classes.Change
to
Also note that the first type argument is the type of the key and the second type parameter is the type of the values. My gut feeling is that you may have swapped them in your code.
Further reading: