I am having below error for this code,
Type mismatch: cannot convert from Set<Map.Entry<Date,List<Transaction>>> to Set<Date>
Code:
final Map<Date, List<Transaction>> transactionsMap= new HashMap<Date, List<Transaction>>();
Set<Date> set = transactionsMap.entrySet(); //Error line
What is this error? how to resolve this?
You need to use
keySet()to get the set of key values.entrySet()returns the set of entries (i.e. key and value combined).If, however, you want to use the
entrySet()method, then you’ll need to use the appropriate type for your variable: