java
package com.gather.map;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
public class MapTest03 {
public static void main(String[] args) {
Map<String,String > m = new HashMap();
m.put("name1","yanyu1");
m.put("name2","yanyu2");
m.put("name3","yanyu3");
// 直接 拿到整个 key - value 键值对
Set<Map.Entry<String, String>> map = m.entrySet();//ctrl alt v
// 拿到了 key value 组成的 node 节点 对象( 含 key value)
for (Map.Entry<String, String> node : map
) {
// String key = node.getKey();
// String value = node.getValue();
System.out.println(node.getKey() + "---->" + node.getValue());
}
}
}
java
package com.gather.map;
import java.util.ResourceBundle;
public class Test {
public static void main(String[] args) {
// RB
ResourceBundle bundle = ResourceBundle.getBundle("com\\gather\\map\\db");
// System.out.println(bundle);
//
System.out.println(bundle.getString("name"));//yanyu
}
}