java-Enumeration

*实现枚举接口的对象生成一系列元素,一次一个。连续呼叫nextElement返回连续元素系列。
例如,打印Vector元素 v

for (Enumeration e = v.elements(); e.hasMoreElements();)
       System.out.println(e.nextElement());

提供方法来枚举A的元素
vector, the keys of a hashtable, and the values in a hashtable.
枚举还用于指定输入流到SequenceInputStream

此接口的功能由迭代器复制接口。此外,迭代器添加了可选的移除操作,以及具有更短的方法名称。新的实现应该考虑使用迭代器优先于枚举。

你可能感兴趣的:(jdk)