public interface Enumeration<E>
nextElement连续单元系列。
例如,要打印一个Vector<E> V的所有元素:
对于(枚举
E = V elements();大肠hasmoreelements();)系统,println(E. nextelement());
提供枚举通过向量元素的方法,一个哈希表的键,并在哈希表中的值。枚举也用于指定一个SequenceInputStream输入流。
注:这个接口的功能是由迭代器接口复制的。此外,迭代器添加了一个可选的删除操作,并且具有较短的方法名称。新的实现应该考虑使用迭代器在枚举的偏好。
Iterator,
SequenceInputStream,
nextElement(),
Hashtable,
Hashtable.elements(),
Hashtable.keys(),
Vector,
Vector.elements()
| Modifier and Type | Method and Description |
|---|---|
boolean |
hasMoreElements()
测试此枚举是否包含更多元素。
|
E |
nextElement()
返回此枚举的下一个元素,如果此枚举对象至少有一个元素可以提供。
|
boolean hasMoreElements()
true当且仅当该枚举对象包含至少一个元素提供;
false否则。
E nextElement()
NoSuchElementException。
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.