Why aren't Enumerations Iterable?

后端 未结 5 1812
隐瞒了意图╮
隐瞒了意图╮ 2020-12-06 09:07

In Java 5 and above you have the foreach loop, which works magically on anything that implements Iterable:

for (Object o : list) {
  doStuff(o);         


        
5条回答
  •  再見小時候
    2020-12-06 09:23

    AFAIK Enumeration is kinda "deprecated":

    Iterator takes the place of Enumeration in the Java collections framework

    I hope they'll change the Servlet API with JSR 315 to use Iterator instead of Enumeration.

提交回复
热议问题