As documented in Enumeration
's Javadoc, you should favor the Iterator
interface over Enumeration
.
Iterator
offers a similar contract to Enumeration
with the addition of a method for removal and shorter method names.
Noncompliant code example
public class MyClass implements Enumeration { // Noncompliant
/* ... */
}
Compliant solution
public class MyClass implements Iterator { // Compliant
/* ... */
}