Collection coll = new ArrayList();
coll.add(1);//添加数据
for(Iterator it = coll.iterator();it.hasNext();){
//想要特有的方法,必须向下转型
String str = (String)it.next();
System.out.println(str.length());
}
Collection集合,迭代器
最新推荐文章于 2023-03-30 15:35:02 发布