赞
踩
of()
of(E e1)
of(E e1, E e2)
of(E e1, E e2, E e3)
...
of()
of(K k1, V v1);
of(K k1 V v1, K k1 V v1, K k2, V v2)
...
注意:只能用Map和List构造,不能使用其子类
Map<String, String> map = Map.of("key1", "xx", "key2", "xx", "key3", "xx");
Set<String> set = map.keySet();
for (String key:set) {
System.out.println(key + "->" + map.get(key));
}
赞
踩
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。