'Storing a String and a List<Tuple> into a HashMap
I have a String id and a List<Tuple> of data.
I need to store this data into a HashMap such that Id is the key and list is the value. How can I achieve this in Java?
Solution 1:[1]
You can do it with something like below format.
Map<String, List<Tuple>> map = new HashMap<>(); //Define new map
List<Tuple> list = new ArrayList<>();
//build your tuples here;
map.put("id", list); // Put them into map witk key- your id
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Zabuzard |
