package Hahah;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
public class Collectiondemo {
public static void main(String[] args) {
Collection c = new ArrayList<>();
c.add("孙悟空");
c.add("爷爷在此");
// 获取迭代器
Iterator it = c.iterator();
while(it.hasNext()) {
String s = (String)it.next();
System.out.println(s);
System.out.println(s.length());
}
}
}