You need to pass an Iterable
or one of its subtypes, e.g., List
, Set
, etc. So, you can add the HashMap
to a List
, and pass it:
HashMap<String,Date> items = new HashMap<String, Date>();
items.put("item1", new Date());
items.put("item2", new Date());
List<HashMap<String, Date>> list = new ArrayList<HashMap<String, Date>>();
list.add(items);
testMethod(list, "more", "data");
Note that since the parameter type is Iterable<HashMap<String, Date>>
, you can only pass - List<HashMap...>
or Set<HashMap...>
, etc. You cannot pass a List<Map..>
in it.