I'm trying to add a value to an ArrayList
.
Here is the code I wrote:
List<Map<String, Object>> list = new ArrayList<>();
list.put(1,"foo", (Object)"bar");
But, this does not work. Anybody have an idea?
List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
Map<String, Object> map = new HashMap<String, Object>();
map.put("foo", "bar");
list.add(map);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With