I work with DefaultMutableTreeNode
, and it has methods depthFirstEnumeration()
, breadthFirstEnumeration()
and children()
No that is not possible with Enumeration
. On this subject, java doc says:
An object that implements the Enumeration interface generates a series of elements, one at a time.
Notice the one at a time which means that if you want to manipulate the Enumeration
as a list then you will have to convert it.
You can create a List when you first request the Enumeration
. This way you could use and manipulate it however you wish.
Enumeration e = ...
ArrayList aList = Collections.list(e);