程序如下:请帮忙看下那5个疑问,3Ks!!
import java.util.*;
public class Text {

public static void main(String[] args) {
Collection c=new HashSet();
c.add(new Name("l1","ggf"));
c.add(new Name("l2","hfh"));
c.add(new Name("l3","hfg"));
Iterator a=c.iterator();
while(a.hasNext()) {
//Name n=(Name)a.next();
System.out.println(a.next()+" ");//为什么这里用a.next()或者改用n加上
//被注释掉的上面那行都可以??????
}

Collection f=new ArrayList();
   f.add(new Name("fggfhh","hgg"));
   f.add(new Name("edg","hgffyu"));
   f.add(new Name("jgyy","hufg"));
   for( a=f.iterator();a.hasNext(); ) {
    Name n=(Name)a.next();
    if(n.x.length()<=3) {//这里为什么把n改成a.next()又不可以了??????
    a.remove();
    //f.remove(n);把上行换成这个不会打印出“hufg“,是为什么呢??????
    System.out.println(n.x);
    //这里为什么把n改成a.next()也不可以了??????
    }
    System.out.println(n.y);
     //这里为什么把n改成a.next()也不可以呀??????
  }
  System.out.println(f+" ");
}
}class Name {
 String x;
 String y;
 Name(String x,String y) {
this.x=x;
this.y=y;
}
public String toString() {
return(x+" "+y);
}
public int hashCode() {
return y.hashCode();//return x.hashCode();也可以String x和y已经重写了
//hashcode()这个方法。。
}
public boolean equals(Object obj) {
if(obj instanceof Name) {
Name name=(Name) obj;
return(x.equals(name.x)&&y.equals(name.y));// 调用了String的equals方法,String已经
  //重写过equals这个方法了。
}
return super.equals(obj);// 调用了Name 的父类Object的equalsfangfa。
}
}