查了这两个的区别:
ne key difference between an enumerator and an iterator is that the iterator will fail if the underlying collection changes.
The Java 1.0/1.1 version of the iterator chose to invent a new name, “enumeration,” instead of using a term that everyone was already familiar with. The Enumeration interface is smaller than Iterator, with only two methods, and it uses longer method names: boolean hasMoreElements( ) produces true if this enumeration contains more elements, and Object nextElement( ) returns the next element of this enumeration if there are any more (otherwise it throws an exception).
Enumeration is only an interface, not an implementation, and even new libraries sometimes still use the old Enumeration, which is unfortunate but generally harmless. Even though you should always use Iterator when you can in your own code, you must be prepared for libraries that want to hand you an Enumeration.
我的问题是:
1 散列与向量用Enumration,链表与树集用Iteration,能否互用。
2 “Enumeration is only an interface, not an implementation”,java里面有implementation这个概念吗,如果有,他们的区别在哪里?
3 链表,散列本身应该可以存储数据,但为何经常要借助对象流对文件读写,而不直接读写链表,散列呢。
ne key difference between an enumerator and an iterator is that the iterator will fail if the underlying collection changes.
The Java 1.0/1.1 version of the iterator chose to invent a new name, “enumeration,” instead of using a term that everyone was already familiar with. The Enumeration interface is smaller than Iterator, with only two methods, and it uses longer method names: boolean hasMoreElements( ) produces true if this enumeration contains more elements, and Object nextElement( ) returns the next element of this enumeration if there are any more (otherwise it throws an exception).
Enumeration is only an interface, not an implementation, and even new libraries sometimes still use the old Enumeration, which is unfortunate but generally harmless. Even though you should always use Iterator when you can in your own code, you must be prepared for libraries that want to hand you an Enumeration.
我的问题是:
1 散列与向量用Enumration,链表与树集用Iteration,能否互用。
2 “Enumeration is only an interface, not an implementation”,java里面有implementation这个概念吗,如果有,他们的区别在哪里?
3 链表,散列本身应该可以存储数据,但为何经常要借助对象流对文件读写,而不直接读写链表,散列呢。
解决方案 »
- 关于getTime()的问题
- Jbuilder项目转到myelipse有类不识别
- 很简单的问题,各位大哥帮帮忙
- 求助----JTable中每次从数据库中取到不同的数据 怎样清空上次记录?
- 排序算法求助,急!
- 请问如固定JFram 窗口的大小,就是让最大化按钮不可用.
- 如何在win2k下安装javacomm20-win32.zip包?
- 为我的jsp聊天室出点主意吧(没做过的不妨尝尝这个挑战哦)。
- 一个关于Java的问题求解,100分(初学者)
- jbuilder上开发的java程序如何移植到scounix???
- 如果把编译好的.class转换成exe可执行文件?
- 初学JAVA,package怎么使用
可以用Iterator删除元素
Iterator方法名改进了