When using guava (See doc) there is Iterators.forEnumeration
. Given an Enumeration x
you can do the following:
to get a immutable Set:
ImmutableSet.copyOf(Iterators.forEnumeration(x));
to get a immutable List:
ImmutableList.copyOf(Iterators.forEnumeration(x));
to get a hashSet:
Sets.newHashSet(Iterators.forEnumeration(x));