Package: org.codehaus.groovy.vmplugin.v8

## [Java] Class PluginDefaultGroovyMethods

- org.codehaus.groovy.vmplugin.v8.PluginDefaultGroovyMethods

- Defines new Groovy methods which appear on normal JDK 8 classes inside the Groovy environment.

  Since:
    2.5.0

- - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `static boolean` | `asBoolean(Optional<?> optional)` Coerce an Optional instance to a boolean value.
    `<T>` | `static Stream<T>` | `stream(T[] self)` Returns a sequential Stream with the specified array as its source.
    `` | `static Stream<Integer>` | `stream(int[] self)` Returns a sequential Stream with the specified array as its source.
    `` | `static Stream<Long>` | `stream(long[] self)` Returns a sequential Stream with the specified array as its source.
    `` | `static Stream<Double>` | `stream(double[] self)` Returns a sequential Stream with the specified array as its source.
    `` | `static Stream<Character>` | `stream(char[] self)` Returns a sequential Stream with the specified array as its source.
    `` | `static Stream<Byte>` | `stream(byte[] self)` Returns a sequential Stream with the specified array as its source.
    `` | `static Stream<Short>` | `stream(short[] self)` Returns a sequential Stream with the specified array as its source.
    `` | `static Stream<Boolean>` | `stream(boolean[] self)` Returns a sequential Stream with the specified array as its source.
    `` | `static Stream<Float>` | `stream(float[] self)` Returns a sequential Stream with the specified array as its source.
    `<T>` | `static List<T>` | `toList(Stream<T> stream)` Accumulates the elements of stream into a new List.
    `<T>` | `static List<T>` | `toList(BaseStream<T, ? extends BaseStream> stream)` Accumulates the elements of stream into a new List.
    `<T>` | `static Set<T>` | `toSet(Stream<T> stream)` Accumulates the elements of stream into a new Set.
    `<T>` | `static Set<T>` | `toSet(BaseStream<T, ? extends BaseStream> stream)` Accumulates the elements of stream into a new Set.

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class Object` | `wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll`

- - ### Method Detail

    - #### public static boolean asBoolean(Optional<?> optional)

      Coerce an Optional instance to a boolean value.

      Parameters:
        `optional` - the Optional
      Returns:
        `true` if a value is present, otherwise `false`

    - #### <T> public static Stream<T> stream(T[] self)

      Returns a sequential Stream with the specified array as its source.

      Parameters:
        `` - The type of the array elements
        `self` - The array, assumed to be unmodified during use
      Returns:
        a `Stream` for the array

    - #### public static Stream<Integer> stream(int[] self)

      Returns a sequential Stream with the specified array as its source.

      Parameters:
        `self` - The array, assumed to be unmodified during use
      Returns:
        a `Stream` for the array

    - #### public static Stream<Long> stream(long[] self)

      Returns a sequential Stream with the specified array as its source.

      Parameters:
        `self` - The array, assumed to be unmodified during use
      Returns:
        a `Stream` for the array

    - #### public static Stream<Double> stream(double[] self)

      Returns a sequential Stream with the specified array as its source.

      Parameters:
        `self` - The array, assumed to be unmodified during use
      Returns:
        a `Stream` for the array

    - #### public static Stream<Character> stream(char[] self)

      Returns a sequential Stream with the specified array as its source.

      Parameters:
        `self` - The array, assumed to be unmodified during use
      Returns:
        a `Stream` for the array

    - #### public static Stream<Byte> stream(byte[] self)

      Returns a sequential Stream with the specified array as its source.

      Parameters:
        `self` - The array, assumed to be unmodified during use
      Returns:
        a `Stream` for the array

    - #### public static Stream<Short> stream(short[] self)

      Returns a sequential Stream with the specified array as its source.

      Parameters:
        `self` - The array, assumed to be unmodified during use
      Returns:
        a `Stream` for the array

    - #### public static Stream<Boolean> stream(boolean[] self)

      Returns a sequential Stream with the specified array as its source.

      Parameters:
        `self` - The array, assumed to be unmodified during use
      Returns:
        a `Stream` for the array

    - #### public static Stream<Float> stream(float[] self)

      Returns a sequential Stream with the specified array as its source.

      Parameters:
        `self` - The array, assumed to be unmodified during use
      Returns:
        a `Stream` for the array

    - #### <T> public static List<T> toList(Stream<T> stream)

      Accumulates the elements of stream into a new List.

      Parameters:
        `stream` - the Stream
        `` - the type of element
      Returns:
        a new `java.util.List` instance

    - #### <T> public static List<T> toList(BaseStream<T, ? extends BaseStream> stream)

      Accumulates the elements of stream into a new List.

      Parameters:
        `stream` - the `java.util.stream.BaseStream`
        `` - the type of element
      Returns:
        a new `java.util.List` instance

    - #### <T> public static Set<T> toSet(Stream<T> stream)

      Accumulates the elements of stream into a new Set.

      Parameters:
        `stream` - the Stream
        `` - the type of element
      Returns:
        a new `java.util.Set` instance

    - #### <T> public static Set<T> toSet(BaseStream<T, ? extends BaseStream> stream)

      Accumulates the elements of stream into a new Set.

      Parameters:
        `stream` - the `java.util.stream.BaseStream`
        `` - the type of element
      Returns:
        a new `java.util.Set` instance