-
Enhancement
-
Resolution: Fixed
-
P5
-
None
-
b21
java.util.Enumeration is a legacy interface from java 1.0.
There are couple of cycles which use it to iterate over collections. We can replace this manual cycle with enchanced-for, which is shorter and easier to read.
javax.naming.directory.BasicAttribute#toString
boolean start = true;
for (Enumeration<Object> e = values.elements(); e.hasMoreElements(); ) {
if (!start)
answer.append(", ");
answer.append(e.nextElement());
start = false;
}
javax.naming.directory.BasicAttributes#writeObject
Enumeration<Attribute> attrEnum = attrs.elements();
while (attrEnum.hasMoreElements()) {
s.writeObject(attrEnum.nextElement());
}
There are couple of cycles which use it to iterate over collections. We can replace this manual cycle with enchanced-for, which is shorter and easier to read.
javax.naming.directory.BasicAttribute#toString
boolean start = true;
for (Enumeration<Object> e = values.elements(); e.hasMoreElements(); ) {
if (!start)
answer.append(", ");
answer.append(e.nextElement());
start = false;
}
javax.naming.directory.BasicAttributes#writeObject
Enumeration<Attribute> attrEnum = attrs.elements();
while (attrEnum.hasMoreElements()) {
s.writeObject(attrEnum.nextElement());
}