My code for presenting results looks like this:
private void presentResult(List<Long> result) {
if(result.size() == 0) {
System.out.println("No matching values for the provided query.");
}
for(String s : result) {
System.out.println(s);
}
}
But I want to return a hashmap instead of a list so I want it to be like this:
private void presentResult(Map<LocalDate, Long> result) {
if(result.size() == 0) {
System.out.println("No matching values for the provided query.");
}
for(Map<LocalDate, Long> s : result) {
System.out.println(s);
}
}
But then I get this error: "Can only iterate over an array or an instance of java.lang.Iterable" How can it be solved?