droidsites droidsites - 13 days ago 7
Java Question

Iterator is fail-fast and Enumeration is not. Are there additional differences between the two other than the points given by Javadoc?

According to Javadoc,


New implementations should consider using Iterator in preference to Enumeration


If newer implementations should consider using Iterator, why is Enumeration not deprecated?

Iterator is fail-fast and Enumeration is not. Are there additional differences between the two other than the points given by Javadoc?

Thanks

Answer

Many things in Java ought to be deprecated but can't because of the vast amount of legacy code. Enumeration is one, Vector, HashTable, Dictionary, Properties are others..