// Collection collections=new ArrayList();
Collection collections2=new HashSet();
ReflectPoint pt1=new ReflectPoint(2,2);
ReflectPoint pt2=new ReflectPoint(3,3);
ReflectPoint pt3=new ReflectPoint(5,5);
collections.add(pt1);
collections.add(pt2);
collections.add(pt3);
collections.add(pt1);
//System.out.println(collections2.size());
System.out.println(collections.size());
若用ArrayList打印的值为4,若用hashset这打印值为3,求他们的内部原理及储存过程?
[ 本帖最后由 王毛毛 于 2011-09-17 10:05 编辑 ] |