I have in my controller a Map<String, Boolean>
private Map<String, Boolean> selectedRequestsMap;
selectedRequestsMap = new HashMap<String, Boolean>();
When i put elements in it added normally (as a Boolean
value)
selectedRequestsMap.put(StringValue, booleanValue);
But when i loop over a Map to read the values
Its considered (as a String
value)
// Loop over selectedRequestsMap
for (Map.Entry<String, Boolean> entry : selectedRequestsMap.entrySet()) {
String key = entry.getKey();
Boolean value = entry.getValue(); // An Exception is raised
// ...
}
Then When i read the
Boolean
value
An Exception
is raised
java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Boolean
Need to know
How i can read a Boolean
value normally ?