Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个这里提到的配置
map-config{ key1 : [ list1, list2, list3 ], key2 : [ list4, list5 ], key3 : [ list6 ] }
加载后一次,除了它有一个键集为 的 Map 之外key1, 其对应的值将是一个带有,key2和的列表。key3list1, list2, list3list4, list5list6
key1
key2
key3
list1, list2, list3
list4, list5
list6
我没有找到直接的方法调用,但下面的代码可以帮助我将配置值存储在Map<String, List<String>>
Map<String, List<String>>
private static void method(Config config) { for( Entry<String, ConfigValue> element : config.entrySet()){ String key = element.getKey(); map.put(key, config.getStringList(key)); } }