将字符串和列表存储<Tuple>到哈希映射中



我有一个数据的String id和一个List<Tuple>。我需要将这些数据存储到HashMap中,以便Id是键,list是值。我如何在Java中实现这一点?

您可以使用以下格式来完成。

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

最新更新