うーん、どうやっても冗長になるなぁ…
public class Hoge {public static void main(String[] args) {
List list = new ArrayList();
list.add("あ");
list.add("い");
list.add("う");
list.add("え");
list.add("お");new ite(list) {
protected void each(Object o) {
System.out.println(o);
}
};
}
}
public class ite {public ite(Collection c) {
Iterator elems = c.iterator();while (elems.hasNext())
each(elems.next());
}protected void each(Object o) {
}}