Enumeration接口的用法

Enumeration接口也在java.util包中 它的功能与Iterator差不多 都是用来遍历集合中的元素  但是枚举Enumeration只提供了遍历Vector和Hashtable类型集合元素的功能  这种类型的集合对象通过调用elements()方法获取一个Enumeration对象  然后Enumeratino对象再调用以下方法来对集合中的元素进行遍历

hasMoreElements():判断Enumeration对象中是否还有数据

nextElement():获取Enumeration对象中的下一个数据

参考链接:http://blog.csdn.net/windy8833/article/details/5299284

posted on 2015-06-30 17:32  linyuhuan  阅读(777)  评论(0编辑  收藏  举报

导航