List list=new ArrayList();
List list2=new LinkedList();
Set set=new HashSet();
//键值对
//Map
Map map=new HashMap();
//map.put("9527", "唐伯虎");
Map map2=new Hashtable();
Properties p=new Properties();
//存值
p.put("9527", "唐伯虎");
p.put("9528", "秋香");
//p.put("9527","祝枝三");//替换覆盖
//p.remove("9528");//删除
System.out.println(p.size());//集合长度
System.out.println(p.get("9528"));//取值
//遍历
Set<Entry<Object, Object>> entrySet=p.entrySet();
for (Entry entry : entrySet) {
System.out.println(entry.getKey()+" "+entry.getValue());
}
//-----------------------------------
Set<Object> keys=p.keySet();
for (Object k : keys) {
System.out.println(k+" "+p.get(k));
}
//-----------------------------------
Collection<Object> values=(Collection<Object>) p.values();
for (Object v : values) {
System.out.println(v);
}
//-----------------------------------
Iterator it=p.entrySet().iterator();
while (it.hasNext()) {
Entry entry=(Entry) it.next();
System.out.println(entry.getKey()+" "+entry.getValue());
}
List list2=new LinkedList();
Set set=new HashSet();
//键值对
//Map
Map map=new HashMap();
//map.put("9527", "唐伯虎");
Map map2=new Hashtable();
Properties p=new Properties();
//存值
p.put("9527", "唐伯虎");
p.put("9528", "秋香");
//p.put("9527","祝枝三");//替换覆盖
//p.remove("9528");//删除
System.out.println(p.size());//集合长度
System.out.println(p.get("9528"));//取值
//遍历
Set<Entry<Object, Object>> entrySet=p.entrySet();
for (Entry entry : entrySet) {
System.out.println(entry.getKey()+" "+entry.getValue());
}
//-----------------------------------
Set<Object> keys=p.keySet();
for (Object k : keys) {
System.out.println(k+" "+p.get(k));
}
//-----------------------------------
Collection<Object> values=(Collection<Object>) p.values();
for (Object v : values) {
System.out.println(v);
}
//-----------------------------------
Iterator it=p.entrySet().iterator();
while (it.hasNext()) {
Entry entry=(Entry) it.next();
System.out.println(entry.getKey()+" "+entry.getValue());
}