您的位置:首页 > 编程语言 > Java开发

J2SE - Enumeration vs Iterator

2011-12-11 19:58 369 查看
Both are used to traverse a sequence of elements.

>> Iterator is new while Enumeration is old.

>> Iterator take the place of Enumeration in Java collections framework.

>> Iterator iterates over a collection while Enumeration iterates over Vector, key and value of Hashtable.

>> Iterator allows to remove elements during the iteration while Enumeration is read only

>> Iterator improves the method names
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息