Convert Enumeration to a Set/List
You can use Collections.list()
to convert an Enumeration
to a List
in one line:
List<T> list = Collections.list(enumeration);
There's no similar method to get a Set
, however you can still do it one line:
Set<T> set = new HashSet<T>(Collections.list(enumeration));
How about this: Collections.list(Enumeration e) returns an ArrayList<T>