HttpServletRequest is using a lot of java.util.Enumeration. I would like to use them in for-each, so i need to convert them into interable. this is not a problem, but I since I have more than one project needing this I need a library to do this. I would rather not make my own - is there any standard library that supports this kind of decoration?
Is there a built-in construct to convert an Enumeration to an Iterable?
Enumeration is like an Iterator , not an Iterable .
java.util.Collections
has a list
method that copies an Enumeration
into a List
, which you can then use in a for-each loop (see javadoc).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With