import java.util.*;
public class qqqq{
private int getBianhao() {
return bianhao;
}
private void setBianhao(int bianhao) {
this.bianhao = bianhao;
}
private String getMingchen() {
return mingchen;
}
private void setMingchen(String mingchen) {
this.mingchen = mingchen;
}
private Integer bianhao;
private String mingchen;
public qqqq(Integer bianhao,String mingchen){
this.bianhao=bianhao;
this.mingchen=mingchen;
}
public static void main(String[]args){
HashMap<Integer,qqqq> hash=new HashMap<Integer,qqqq>();
qqqq one1=new qqqq(1,"苹果1");
qqqq one2=new qqqq(2,"苹果2");
qqqq one3=new qqqq(3,"苹果3");
qqqq one4=new qqqq(4,"苹果4");
qqqq one5=new qqqq(5,"苹果5");
hash.put(1,one1);
hash.put(2,one2);
hash.put(3,one3);
hash.put(4,one4);
hash.put(5,one5);
Collection<qqqq> collection = hash.values();
Iterator<qqqq> itt=collection.iterator();
System.out.println("输出值");//输出的老是16进制码
while(itt.hasNext()){
System.out.println(itt.next());
}
Set<Integer>keys=hash.keySet();
System.out.println("输出键");
Iterator tt=keys.iterator();
while(tt.hasNext()){
System.out.print(tt.next()+"\t");
}
System.out.println("输出完整的信息");
for(Integer key:keys){
System.out.println("编号:"+key+"\t名称:"+hash.get(key));
}
}
}