Reputation: 1
I am looking to create an arraylist, with a hashmap in each value. Not sure how to even start this? Anybody have some old code, or can help out?
Upvotes: 0
Views: 39
Reputation: 7207
In Java
ArrayList<Map<Integer, String>> list = new Arraylist<>();
list.add(new HashMap<Integer, String>());
list.get(0).put(1, "Value");
Upvotes: 1
Reputation: 10943
With generic in Java:
ArrayList<HashMap<Integer,String>> david = new ArrayList<HashMap<Integer,String>>();
david.add(new HashMap<Integer,String>());
Upvotes: 0