Package: org.codehaus.groovy.vmplugin.v8

## [Java] Class PluginDefaultGroovyMethods

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

-     public class PluginDefaultGroovyMethods
      extends DefaultGroovyMethodsSupport

  Defines new Groovy methods which appear on standard Java 8 classes within the Groovy environment.

  Since:
    2.5.0

- - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public static boolean` | `asBoolean(Optional<?> optional)` Coerce an `Optional` instance to a `boolean` value.
    `<S, T>` | `public static Future<T>` | `collect(Future<S> self, Closure<T> transform)` Returns a `Future` asynchronously returning a transformed result.
    `<S, T>` | `public static Optional<T>` | `collect(Optional<S> self, Closure<T> transform)` If a value is present in the `Optional`, returns transformed value obtained using the `transform` closure or no value as an optional.
    `` | `public static DoubleStream` | `doubleStream(double[] self)` Returns a DoubleStream over the supplied `double` array.
    `<T>` | `public static Optional<T>` | `filter(Optional<?> self, Class<T> type)` Tests given value against specified type and changes generics of result.
    `` | `public static OptionalInt` | `filter(OptionalInt self, IntPredicate test)` If a value is present in the `OptionalInt`, tests the value using the given predicate and returns the optional if the test returns true or else empty.
    `` | `public static OptionalLong` | `filter(OptionalLong self, LongPredicate test)` If a value is present in the `OptionalLong`, tests the value using the given predicate and returns the optional if the test returns true or else empty.
    `` | `public static OptionalDouble` | `filter(OptionalDouble self, DoublePredicate test)` If a value is present in the `OptionalDouble`, tests the value using the given predicate and returns the optional if the test returns true or empty otherwise.
    `` | `public static int` | `get(OptionalInt self)` If a value is present in the `OptionalInt`, returns the value.
    `` | `public static long` | `get(OptionalLong self)` If a value is present in the `OptionalLong`, returns the value.
    `` | `public static double` | `get(OptionalDouble self)` If a value is present in the `OptionalDouble`, returns the value.
    `<T>` | `public static T` | `getAt(Optional<T> self, int index)` If a value is present in the `Optional`, returns the value or null.
    `` | `public static String` | `getPid(Runtime self)` Gets the pid of the current Java process.
    `` | `public static IntStream` | `intStream(int[] self)` Returns an IntStream over the supplied `int` array.
    `` | `public static StringBuilder` | `leftShift(StringBuilder self, Object value)` Overloads the left shift operator to provide an easy way to append multiple objects as string representations to a StringBuilder.
    `` | `public static LongStream` | `longStream(long[] self)` Returns a LongStream over the supplied `long` array.
    `<T>` | `public static OptionalDouble` | `mapToDouble(Optional<T> self, ToDoubleFunction<? super T> mapper)` If a value is present in the `Optional`, returns an `OptionalDouble` consisting of the result of applying the given function to the value or else empty.
    `<T>` | `public static OptionalInt` | `mapToInt(Optional<T> self, ToIntFunction<? super T> mapper)` If a value is present in the `Optional`, returns an `OptionalInt` consisting of the result of applying the given function to the value or else empty.
    `<T>` | `public static OptionalLong` | `mapToLong(Optional<T> self, ToLongFunction<? super T> mapper)` If a value is present in the `Optional`, returns an `OptionalLong` consisting of the result of applying the given function to the value or else empty.
    `<T>` | `public static Optional<T>` | `mapToObj(OptionalInt self, IntFunction<? extends T> mapper)` If a value is present in the `OptionalInt`, returns an `Optional` consisting of the result of applying the given function to the value or else empty.
    `<T>` | `public static Optional<T>` | `mapToObj(OptionalLong self, LongFunction<? extends T> mapper)` If a value is present in the `OptionalLong`, returns an `Optional` consisting of the result of applying the given function to the value or else empty.
    `<T>` | `public static Optional<T>` | `mapToObj(OptionalDouble self, DoubleFunction<? extends T> mapper)` If a value is present in the `OptionalDouble`, returns an `Optional` consisting of the result of applying the given function to the value or else empty.
    `` | `public static Object` | `next(Enum self)` Overloads the `++` operator for enums.
    `<T>` | `public static Optional<T>` | `orOptional(Optional<T> self, Supplier<Optional<? extends T>> supplier)` Provides similar functionality to JDK9 `or` on JDK8.
    `` | `public static OptionalInt` | `peek(OptionalInt self, IntConsumer action)` If a value is present in the `OptionalInt`, executes the specified `action` with the value as input and then returns `self`.
    `` | `public static OptionalLong` | `peek(OptionalLong self, LongConsumer action)` If a value is present in the `OptionalLong`, executes the specified `action` with the value as input and then returns `self`.
    `` | `public static OptionalDouble` | `peek(OptionalDouble self, DoubleConsumer action)` If a value is present in the `OptionalDouble`, executes the specified `action` with the value as input and then returns `self`.
    `<T>` | `public static Optional<T>` | `peek(Optional<T> self, Consumer<? super T> action)` If a value is present in the `Optional`, executes the specified `action` with the value as input and then returns `self`.
    `` | `public static String` | `plus(StringBuilder self, String value)` Appends a String to this StringBuilder.
    `` | `public static Object` | `previous(Enum self)` Overloads the `--` operator for enums.
    `` | `public static void` | `putAt(StringBuilder self, EmptyRange range, Object value)` Supports the range subscript operator for StringBuilder.
    `` | `public static void` | `putAt(StringBuilder self, IntRange range, Object value)` Supports the range subscript operator for StringBuilder.
    `` | `public static int` | `size(StringBuilder self)` Provides the standard Groovy `size()` method for StringBuilder.
    `<T>` | `public static Stream<T>` | `stream(T self)` Returns a single-element stream for the supplied object.
    `<T>` | `public static Stream<T>` | `stream(T[] self)` Returns a stream over the supplied array.
    `` | `public static Stream<Integer>` | `stream(int[] self)` Returns a boxed stream over the supplied `int` array.
    `` | `public static Stream<Long>` | `stream(long[] self)` Returns a boxed stream over the supplied `long` array.
    `` | `public static Stream<Double>` | `stream(double[] self)` Returns a boxed stream over the supplied `double` array.
    `` | `public static Stream<Character>` | `stream(char[] self)` Returns a boxed stream over the supplied `char` array.
    `` | `public static Stream<Byte>` | `stream(byte[] self)` Returns a boxed stream over the supplied `byte` array.
    `` | `public static Stream<Short>` | `stream(short[] self)` Returns a boxed stream over the supplied `short` array.
    `` | `public static Stream<Boolean>` | `stream(boolean[] self)` Returns a boxed stream over the supplied `boolean` array.
    `` | `public static Stream<Float>` | `stream(float[] self)` Returns a boxed stream over the supplied `float` array.
    `<T>` | `public static Stream<T>` | `stream(Enumeration<T> self)` Returns a stream over the supplied enumeration.
    `<T>` | `public static Stream<T>` | `stream(Iterable<T> self)` Returns a stream over the supplied iterable.
    `<T>` | `public static Stream<T>` | `stream(Iterator<T> self)` Returns a stream over the supplied iterator.
    `<T>` | `public static Stream<T>` | `stream(Spliterator<T> self)` Returns a stream over the supplied spliterator.
    `<T>` | `public static Stream<T>` | `stream(NullObject self)` Returns an empty stream for Groovy's null-object sentinel.
    `<T>` | `public static Stream<T>` | `stream(Optional<T> self)` Returns a stream over the supplied optional value.
    `` | `public static IntStream` | `stream(OptionalInt self)` Returns an IntStream over the supplied optional int value.
    `` | `public static LongStream` | `stream(OptionalLong self)` Returns a LongStream over the supplied optional long value.
    `` | `public static DoubleStream` | `stream(OptionalDouble self)` Returns a DoubleStream over the supplied optional double value.
    `<T>` | `public static T[]` | `toArray(Stream<? extends T> self, Class<T> type)` Collects the stream elements into a typed array.
    `<T>` | `public static List<T>` | `toList(Stream<T> self)` Collects the stream elements into a list.
    `<T>` | `public static List<T>` | `toList(BaseStream<T, ? extends BaseStream> self)` Collects the base-stream elements into a list.
    `<T>` | `public static Set<T>` | `toSet(Stream<T> self)` Collects the stream elements into a set.
    `<T>` | `public static Set<T>` | `toSet(BaseStream<T, ? extends BaseStream> self)` Collects the base-stream elements into a set.

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class DefaultGroovyMethodsSupport` | `cloneSimilarCollection, cloneSimilarMap, closeQuietly, closeWithWarning, createSimilarArray, createSimilarCollection, createSimilarCollection, createSimilarCollection, createSimilarList, createSimilarMap, createSimilarOrDefaultCollection, createSimilarQueue, createSimilarSet, normaliseIndex, sameType, sameType, subListBorders, subListBorders, subListRange, writeUTF16BomIfRequired, writeUTF16BomIfRequired, writeUTF16BomIfRequired, writeUTF16BomIfRequired`

- - ### Method Detail

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

      Coerce an `Optional` instance to a `boolean` value.

           assert !Optional.empty().asBoolean()
           assert Optional.of(1234).asBoolean()

      Returns:
        `true` if a value is present, `false` otherwise
      Since:
        2.5.0

    - #### <S, T> public static Future<T> collect(Future<S> self, @ClosureParams(FirstParam.FirstGenericType.class)
      Closure<T> transform)

      Returns a `Future` asynchronously returning a transformed result.

           import java.util.concurrent.*
           def executor = Executors.newSingleThreadExecutor()
           Future foobar = executor.submit{ "foobar" }
           Future foobarSize = foobar.collect{ it.size() }
           assert foobarSize.get() == 6
           executor.shutdown()

      Parameters:
        `self` - a Future
        `transform` - the closure used to transform the Future value
      Returns:
        a Future allowing the transformed value to be obtained asynchronously
      Since:
        3.0.0

    - #### <S, T> public static Optional<T> collect(Optional<S> self, @ClosureParams(FirstParam.FirstGenericType.class)
      Closure<T> transform)

      If a value is present in the `Optional`, returns transformed value obtained using the `transform` closure or no value as an optional.

           assert Optional.of("foobar").collect{ it.size() }.get() == 6
           assert !Optional.empty().collect{ it.size() }.isPresent()

      Parameters:
        `transform` - the closure used to transform the optional value if present
      Returns:
        an Optional containing the transformed value or empty if the input is empty or the transform returns null
      Since:
        3.0.0

    - #### @Deprecated
      public static DoubleStream doubleStream(double[] self)

      Returns a DoubleStream over the supplied `double` array.

      Parameters:
        `self` - the source array
      Returns:
        a double stream over the array contents

    - #### <T> public static Optional<T> filter(Optional<?> self, Class<T> type)

      Tests given value against specified type and changes generics of result. This is equivalent to: `self.filter(it -> it instanceof Type).map(it -> (Type) it)`

           assert !Optional.empty().filter(Number).isPresent()
           assert !Optional.of('x').filter(Number).isPresent()
           assert Optional.of(1234).filter(Number).isPresent()
           assert Optional.of(1234).filter(Number).get().equals(1234)

      Since:
        3.0.0

    - #### public static OptionalInt filter(OptionalInt self, IntPredicate test)

      If a value is present in the `OptionalInt`, tests the value using the given predicate and returns the optional if the test returns true or else empty.

           assert !OptionalInt.empty().filter(i -> true).isPresent()
           assert  OptionalInt.of(1234).filter(i -> true).isPresent()
           assert !OptionalInt.of(1234).filter(i -> false).isPresent()
           assert  OptionalInt.of(1234).filter(i -> true).getAsInt() == 1234

      Since:
        3.0.0

    - #### public static OptionalLong filter(OptionalLong self, LongPredicate test)

      If a value is present in the `OptionalLong`, tests the value using the given predicate and returns the optional if the test returns true or else empty.

           assert !OptionalLong.empty().filter(n -> true).isPresent()
           assert  OptionalLong.of(123L).filter(n -> true).isPresent()
           assert !OptionalLong.of(123L).filter(n -> false).isPresent()
           assert  OptionalLong.of(123L).filter(n -> true).getAsLong() == 123L

      Since:
        3.0.0

    - #### public static OptionalDouble filter(OptionalDouble self, DoublePredicate test)

      If a value is present in the `OptionalDouble`, tests the value using the given predicate and returns the optional if the test returns true or empty otherwise.

           assert !OptionalDouble.empty().filter(n -> true).isPresent()
           assert  OptionalDouble.of(Math.PI).filter(n -> true).isPresent()
           assert !OptionalDouble.of(Math.PI).filter(n -> false).isPresent()
           assert  OptionalDouble.of(Math.PI).filter(n -> true).getAsDouble() == Math.PI

      Since:
        3.0.0

    - #### public static int get(OptionalInt self)

      If a value is present in the `OptionalInt`, returns the value.

           assert OptionalInt.of(1234).get() == 1234

      throws:
        NoSuchElementException if no value is present
      Since:
        3.0.0

    - #### public static long get(OptionalLong self)

      If a value is present in the `OptionalLong`, returns the value.

           assert OptionalLong.of(1234L).get() == 1234L

      throws:
        NoSuchElementException if no value is present
      Since:
        3.0.0

    - #### public static double get(OptionalDouble self)

      If a value is present in the `OptionalDouble`, returns the value.

           assert OptionalDouble.of(Math.PI).get() == Math.PI

      throws:
        NoSuchElementException if no value is present
      Since:
        3.0.0

    - #### <T> public static T getAt(Optional<T> self, int index)

      If a value is present in the `Optional`, returns the value or null.

           def opt = Optional.empty()
           assert opt[-1] == null
           assert opt[0] == null
           opt = Optional.of('')
           assert opt[-1] == ''
           assert opt[0] == ''

           groovy.test.GroovyAssert.shouldFail(IndexOutOfBoundsException) { opt[1] }

           // use via destructuring
           opt = Optional.empty()
           def (String s) = opt
           assert s == null
           opt = Optional.of('')
           (s) = opt
           assert s == ''

      throws:
        IndexOutOfBoundsException if index is not 0 or -1
      Since:
        5.0.0

    - #### public static String getPid(Runtime self)

      Gets the pid of the current Java process.

      Since:
        4.0.0

    - #### @Deprecated
      public static IntStream intStream(int[] self)

      Returns an IntStream over the supplied `int` array.

      Parameters:
        `self` - the source array
      Returns:
        an int stream over the array contents

    - #### public static StringBuilder leftShift(StringBuilder self, Object value)

      Overloads the left shift operator to provide an easy way to append multiple objects as string representations to a StringBuilder.

      Parameters:
        `self` - a StringBuilder
        `value` - a value to append
      Returns:
        the StringBuilder on which this operation was invoked
      Since:
        1.5.2

    - #### @Deprecated
      public static LongStream longStream(long[] self)

      Returns a LongStream over the supplied `long` array.

      Parameters:
        `self` - the source array
      Returns:
        a long stream over the array contents

    - #### <T> public static OptionalDouble mapToDouble(Optional<T> self, ToDoubleFunction<? super T> mapper)

      If a value is present in the `Optional`, returns an `OptionalDouble` consisting of the result of applying the given function to the value or else empty.

           assert !Optional.empty().mapToDouble(x -> Math.PI).isPresent()
           assert  Optional.of('x').mapToDouble(x -> Math.PI).getAsDouble() == Math.PI

      Since:
        3.0.0

    - #### <T> public static OptionalInt mapToInt(Optional<T> self, ToIntFunction<? super T> mapper)

      If a value is present in the `Optional`, returns an `OptionalInt` consisting of the result of applying the given function to the value or else empty.

           assert !Optional.empty().mapToInt(x -> 42).isPresent()
           assert  Optional.of('x').mapToInt(x -> 42).getAsInt() == 42

      Since:
        3.0.0

    - #### <T> public static OptionalLong mapToLong(Optional<T> self, ToLongFunction<? super T> mapper)

      If a value is present in the `Optional`, returns an `OptionalLong` consisting of the result of applying the given function to the value or else empty.

           assert !Optional.empty().mapToLong(x -> 42L).isPresent()
           assert  Optional.of('x').mapToLong(x -> 42L).getAsLong() == 42L

      Since:
        3.0.0

    - #### <T> public static Optional<T> mapToObj(OptionalInt self, IntFunction<? extends T> mapper)

      If a value is present in the `OptionalInt`, returns an `Optional` consisting of the result of applying the given function to the value or else empty.

           assert !OptionalInt.empty().mapToObj(x -> new Object()).isPresent()
           assert  OptionalInt.of(1234).mapToObj(x -> new Object()).isPresent()
           assert !OptionalInt.of(1234).mapToObj(x -> null).isPresent()
           assert  OptionalInt.of(1234).mapToObj(Integer::toString).get() == '1234'

      Since:
        3.0.0

    - #### <T> public static Optional<T> mapToObj(OptionalLong self, LongFunction<? extends T> mapper)

      If a value is present in the `OptionalLong`, returns an `Optional` consisting of the result of applying the given function to the value or else empty.

           assert !OptionalLong.empty().mapToObj(x -> new Object()).isPresent()
           assert  OptionalLong.of(123L).mapToObj(x -> new Object()).isPresent()
           assert !OptionalLong.of(123L).mapToObj(x -> null).isPresent()
           assert  OptionalLong.of(1234L).mapToObj(Long::toString).get() == '1234'

      Since:
        3.0.0

    - #### <T> public static Optional<T> mapToObj(OptionalDouble self, DoubleFunction<? extends T> mapper)

      If a value is present in the `OptionalDouble`, returns an `Optional` consisting of the result of applying the given function to the value or else empty.

           assert !OptionalDouble.empty().mapToObj(x -> new Object()).isPresent()
           assert  OptionalDouble.of(Math.PI).mapToObj(x -> new Object()).isPresent()
           assert !OptionalDouble.of(Math.PI).mapToObj(x -> null).isPresent()
           assert  OptionalDouble.of(Math.PI).mapToObj(Double::toString).get().startsWith('3.14')

      Since:
        3.0.0

    - #### public static Object next(Enum self)

      Overloads the `++` operator for enums. It will invoke Groovy's default next behaviour for enums that do not have their own next method.

      Parameters:
        `self` - an Enum
      Returns:
        the next defined enum from the enum class
      Since:
        1.5.2

    - #### <T> public static Optional<T> orOptional(Optional<T> self, Supplier<Optional<? extends T>> supplier)

      Provides similar functionality to JDK9 `or` on JDK8.

           def x = Optional.empty()
           def y = Optional.of('y')
           assert y.orOptional(() -> Optional.of('z')).get() == 'y'
           assert x.orOptional(() -> Optional.of('z')).get() == 'z'

      Since:
        3.0.6

    - #### public static OptionalInt peek(OptionalInt self, IntConsumer action)

      If a value is present in the `OptionalInt`, executes the specified `action` with the value as input and then returns `self`.

           boolean called = false
           def opt = OptionalInt.empty()
           def out = opt.peek{ called = true }
           assert out === opt
           assert !called

           opt = OptionalInt.of(42)
           out = opt.peek{ assert it == 42; called = true }
           assert out === opt
           assert called

      Since:
        5.0.0

    - #### public static OptionalLong peek(OptionalLong self, LongConsumer action)

      If a value is present in the `OptionalLong`, executes the specified `action` with the value as input and then returns `self`.

           boolean called = false
           def opt = OptionalLong.empty()
           def out = opt.peek{ called = true }
           assert out === opt
           assert !called

           opt = OptionalLong.of(42L)
           out = opt.peek{ assert it == 42L; called = true }
           assert out === opt
           assert called

      Since:
        5.0.0

    - #### public static OptionalDouble peek(OptionalDouble self, DoubleConsumer action)

      If a value is present in the `OptionalDouble`, executes the specified `action` with the value as input and then returns `self`.

           boolean called = false
           def opt = OptionalDouble.empty()
           def out = opt.peek{ called = true }
           assert out === opt
           assert !called

           opt = OptionalDouble.of(Math.PI)
           out = opt.peek{ assert it == Math.PI; called = true }
           assert out === opt
           assert called

      Since:
        5.0.0

    - #### <T> public static Optional<T> peek(Optional<T> self, Consumer<? super T> action)

      If a value is present in the `Optional`, executes the specified `action` with the value as input and then returns `self`.

           boolean called = false
           def opt = Optional.empty()
           def out = opt.peek{ called = true }
           assert out === opt
           assert !called

           opt = Optional.of('x')
           out = opt.peek{ assert it == 'x'; called = true }
           assert out === opt
           assert called

      Since:
        5.0.0

    - #### public static String plus(StringBuilder self, String value)

      Appends a String to this StringBuilder.

      Parameters:
        `self` - a StringBuilder
        `value` - a String
      Returns:
        a String
      Since:
        1.5.2

    - #### public static Object previous(Enum self)

      Overloads the `--` operator for enums. It will invoke Groovy's default previous behaviour for enums that do not have their own previous method.

      Parameters:
        `self` - an Enum
      Returns:
        the previous defined enum from the enum class
      Since:
        1.5.2

    - #### public static void putAt(StringBuilder self, EmptyRange range, Object value)

      Supports the range subscript operator for StringBuilder.

      Parameters:
        `self` - a StringBuilder
        `range` - a Range
        `value` - the object that's toString() will be inserted
      Since:
        1.5.2

    - #### public static void putAt(StringBuilder self, IntRange range, Object value)

      Supports the range subscript operator for StringBuilder. Index values are treated as characters within the builder.

      Parameters:
        `self` - a StringBuilder
        `range` - a Range
        `value` - the object that's toString() will be inserted
      Since:
        1.5.2

    - #### @Deprecated
      public static int size(StringBuilder self)

      Provides the standard Groovy `size()` method for StringBuilder.

      Parameters:
        `self` - a StringBuilder
      Returns:
        the length of the StringBuilder
      Since:
        1.5.2
      See Also:
        StringGroovyMethods.size

    - #### <T> @Deprecated
      public static Stream<T> stream(T self)

      Returns a single-element stream for the supplied object.

      Parameters:
        `self` - the source element
      Type Parameters:
        `T` - the element type
      Returns:
        a stream containing `self`

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

      Returns a stream over the supplied array.

      Parameters:
        `self` - the source array
      Type Parameters:
        `T` - the element type
      Returns:
        a stream over the array contents

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

      Returns a boxed stream over the supplied `int` array.

      Parameters:
        `self` - the source array
      Returns:
        a stream over the array contents

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

      Returns a boxed stream over the supplied `long` array.

      Parameters:
        `self` - the source array
      Returns:
        a stream over the array contents

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

      Returns a boxed stream over the supplied `double` array.

      Parameters:
        `self` - the source array
      Returns:
        a stream over the array contents

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

      Returns a boxed stream over the supplied `char` array.

      Parameters:
        `self` - the source array
      Returns:
        a stream over the array contents

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

      Returns a boxed stream over the supplied `byte` array.

      Parameters:
        `self` - the source array
      Returns:
        a stream over the array contents

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

      Returns a boxed stream over the supplied `short` array.

      Parameters:
        `self` - the source array
      Returns:
        a stream over the array contents

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

      Returns a boxed stream over the supplied `boolean` array.

      Parameters:
        `self` - the source array
      Returns:
        a stream over the array contents

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

      Returns a boxed stream over the supplied `float` array.

      Parameters:
        `self` - the source array
      Returns:
        a stream over the array contents

    - #### <T> @Deprecated
      public static Stream<T> stream(Enumeration<T> self)

      Returns a stream over the supplied enumeration.

      Parameters:
        `self` - the source enumeration
      Type Parameters:
        `T` - the element type
      Returns:
        a stream over the enumeration contents

    - #### <T> @Deprecated
      public static Stream<T> stream(Iterable<T> self)

      Returns a stream over the supplied iterable.

      Parameters:
        `self` - the source iterable
      Type Parameters:
        `T` - the element type
      Returns:
        a stream over the iterable contents

    - #### <T> @Deprecated
      public static Stream<T> stream(Iterator<T> self)

      Returns a stream over the supplied iterator.

      Parameters:
        `self` - the source iterator
      Type Parameters:
        `T` - the element type
      Returns:
        a stream over the iterator contents

    - #### <T> @Deprecated
      public static Stream<T> stream(Spliterator<T> self)

      Returns a stream over the supplied spliterator.

      Parameters:
        `self` - the source spliterator
      Type Parameters:
        `T` - the element type
      Returns:
        a stream over the spliterator contents

    - #### <T> @Deprecated
      public static Stream<T> stream(NullObject self)

      Returns an empty stream for Groovy's null-object sentinel.

      Parameters:
        `self` - the null-object sentinel
      Type Parameters:
        `T` - the element type
      Returns:
        an empty stream

    - #### <T> @Deprecated
      public static Stream<T> stream(Optional<T> self)

      Returns a stream over the supplied optional value.

      Parameters:
        `self` - the source optional
      Type Parameters:
        `T` - the element type
      Returns:
        a stream containing the optional value when present

    - #### @Deprecated
      public static IntStream stream(OptionalInt self)

      Returns an IntStream over the supplied optional int value.

      Parameters:
        `self` - the source optional int
      Returns:
        a stream containing the optional value when present

    - #### @Deprecated
      public static LongStream stream(OptionalLong self)

      Returns a LongStream over the supplied optional long value.

      Parameters:
        `self` - the source optional long
      Returns:
        a stream containing the optional value when present

    - #### @Deprecated
      public static DoubleStream stream(OptionalDouble self)

      Returns a DoubleStream over the supplied optional double value.

      Parameters:
        `self` - the source optional double
      Returns:
        a stream containing the optional value when present

    - #### <T> @Deprecated
      public static T[] toArray(Stream<? extends T> self, Class<T> type)

      Collects the stream elements into a typed array.

      Parameters:
        `self` - the source stream
        `type` - the component type of the target array
      Type Parameters:
        `T` - the element type
      Returns:
        an array containing the stream elements

    - #### <T> @Deprecated
      public static List<T> toList(Stream<T> self)

      Collects the stream elements into a list.

      Parameters:
        `self` - the source stream
      Type Parameters:
        `T` - the element type
      Returns:
        a list containing the stream elements

    - #### <T> @Deprecated
      public static List<T> toList(BaseStream<T, ? extends BaseStream> self)

      Collects the base-stream elements into a list.

      Parameters:
        `self` - the source base stream
      Type Parameters:
        `T` - the element type
      Returns:
        a list containing the stream elements

    - #### <T> @Deprecated
      public static Set<T> toSet(Stream<T> self)

      Collects the stream elements into a set.

      Parameters:
        `self` - the source stream
      Type Parameters:
        `T` - the element type
      Returns:
        a set containing the stream elements

    - #### <T> @Deprecated
      public static Set<T> toSet(BaseStream<T, ? extends BaseStream> self)

      Collects the base-stream elements into a set.

      Parameters:
        `self` - the source base stream
      Type Parameters:
        `T` - the element type
      Returns:
        a set containing the stream elements