Enumeration (Groovy JDK enhancements)

Package: java.util

## Interface Enumeration

- - ### Methods Summary

    Methods
    Return type | Name and parameters
    --- | ---
    `boolean` | `asBoolean()` Coerce an enumeration instance to a boolean value.
    `Iterator` | `iterator()` Allows an Enumeration to behave like an Iterable.
    `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.

- - ### Methods Detail

    - #### public boolean asBoolean()

      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.

      Returns:
        the boolean value
      Since:
        1.7.0

    - #### public Iterator iterator()

      Allows an Enumeration to behave like an Iterable. Note that the Iterator#remove() remove() method is unsupported since the underlying Enumeration doesn't provide a mechanism for removing items.

      Returns:
        an Iterator for the given Enumeration
      Since:
        1.0

    - #### public Stream stream()

      Returns a sequential Stream with the specified element(s) as its source.

          def tokens = new StringTokenizer('one two')
          assert tokens.stream().toList() == ['one', 'two']

      Since:
        3.0.0

    - #### public List toList()

      Convert an enumeration to a List.

      Returns:
        a List
      Since:
        1.5.0

    - #### public Set toSet()

      Convert an enumeration to a Set.

      Returns:
        a Set
      Since:
        1.8.0