Convenient enumeration over an array of enumeration. For example:
Enumeration e1 = v1.elements();
while (e1.hasMoreElements()) {
// do something
}
Enumeration e2 = v2.elements();
while (e2.hasMoreElements()) {
// do the same thing
}
can be written as:
Enumeration[] enums = { v1.elements(), v2.elements() };
Enumeration e = Enumerations.fromCompound(enums);
while (e.hasMoreElements()) {
// do something
}
Note that the enumeration will skip null elements in the array. The following is
thus possible:
Enumeration[] enums = { v1.elements(), null, v2.elements() }; // a null enumeration in the array
Enumeration e = Enumerations.fromCompound(enums);
while (e.hasMoreElements()) {
// do something
}