public static <K, V> Map<K, V> listToMap(List<K> keys, List<V> values) {
return keys.stream().collect(Collectors.toMap(key -> key, key -> values.get(keys.indexOf(key))));
}
list转map
最新推荐文章于 2023-08-21 11:51:56 发布
public static <K, V> Map<K, V> listToMap(List<K> keys, List<V> values) {
return keys.stream().collect(Collectors.toMap(key -> key, key -> values.get(keys.indexOf(key))));
}