Return type | Name and parameters |
---|---|
boolean
|
asBoolean()
Coerce an enumeration instance to a boolean value. |
Iterator
|
iterator()
Allows an Enumeration to behave like an Iterator. |
Stream
|
stream()
Returns a sequential Stream with the specified element(s) as its source. |
List
|
toList()
Convert an enumeration to a List. |
Set
|
toSet()
Convert an enumeration to a Set. |
Coerce an enumeration instance to a boolean value. An enumeration is coerced to false if there are no more elements to enumerate, and to true otherwise.
Allows an Enumeration to behave like an Iterator. Note that the Iterator#remove() remove() method is unsupported since the underlying Enumeration does not provide a mechanism for removing items.
Returns a sequential Stream with the specified element(s) as its source.
def tokens = new StringTokenizer('one two') assert tokens.stream().toList() == ['one', 'two']
Convert an enumeration to a List.
Convert an enumeration to a Set.