Package org.codehaus.groovy.vmplugin.v8

# Class PluginDefaultGroovyMethods

java.lang.Object
org.codehaus.groovy.runtime.DefaultGroovyMethodsSupport
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

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static boolean`
  `asBoolean(Optional<?> optional)`
  Coerce an `Optional` instance to a `boolean` value.
  `static <S, T> Future<T>`
  `collect(Future<S> self, Closure<T> transform)`
  Returns a `Future` asynchronously returning a transformed result.
  `static <S, T> 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.
  `static DoubleStream`
  `doubleStream(double[] self)`
  Deprecated.
  `static <T> Optional<T>`
  `filter(Optional<?> self, Class<T> type)`
  Tests given value against specified type and changes generics of result.
  `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.
  `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.
  `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.
  `static double`
  `get(OptionalDouble self)`
  If a value is present in the `OptionalDouble`, returns the value.
  `static int`
  `get(OptionalInt self)`
  If a value is present in the `OptionalInt`, returns the value.
  `static long`
  `get(OptionalLong self)`
  If a value is present in the `OptionalLong`, returns the value.
  `static <T> T`
  `getAt(Optional<T> self, int index)`
  If a value is present in the `Optional`, returns the value or null.
  `static String`
  `getPid(Runtime self)`
  Gets the pid of the current Java process.
  `static IntStream`
  `intStream(int[] self)`
  Deprecated.
  `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.
  `static LongStream`
  `longStream(long[] self)`
  Deprecated.
  `static <T> 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.
  `static <T> 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.
  `static <T> 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.
  `static <T> 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.
  `static <T> 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.
  `static <T> 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.
  `static Object`
  `next(Enum self)`
  Overloads the `++` operator for enums.
  `static <T> Optional<T>`
  `orOptional(Optional<T> self, Supplier<Optional<? extends T>> supplier)`
  Provides similar functionality to JDK9 `or` on JDK8.
  `static <T> 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`.
  `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`.
  `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`.
  `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`.
  `static String`
  `plus(StringBuilder self, String value)`
  Appends a String to this StringBuilder.
  `static Object`
  `previous(Enum self)`
  Overloads the `--` operator for enums.
  `static void`
  `putAt(StringBuilder self, EmptyRange range, Object value)`
  Supports the range subscript operator for StringBuilder.
  `static void`
  `putAt(StringBuilder self, IntRange range, Object value)`
  Supports the range subscript operator for StringBuilder.
  `static int`
  `size(StringBuilder self)`
  Deprecated.
  `static Stream<Boolean>`
  `stream(boolean[] self)`
  Deprecated.
  `static Stream<Byte>`
  `stream(byte[] self)`
  Deprecated.
  `static Stream<Character>`
  `stream(char[] self)`
  Deprecated.
  `static Stream<Double>`
  `stream(double[] self)`
  Deprecated.
  `static Stream<Float>`
  `stream(float[] self)`
  Deprecated.
  `static Stream<Integer>`
  `stream(int[] self)`
  Deprecated.
  `static Stream<Long>`
  `stream(long[] self)`
  Deprecated.
  `static Stream<Short>`
  `stream(short[] self)`
  Deprecated.
  `static <T> Stream<T>`
  `stream(Iterable<T> self)`
  Deprecated.
  `static <T> Stream<T>`
  `stream(Enumeration<T> self)`
  Deprecated.
  `static <T> Stream<T>`
  `stream(Iterator<T> self)`
  Deprecated.
  `static <T> Stream<T>`
  `stream(Optional<T> self)`
  Deprecated.
  `static DoubleStream`
  `stream(OptionalDouble self)`
  Deprecated.
  `static IntStream`
  `stream(OptionalInt self)`
  Deprecated.
  `static LongStream`
  `stream(OptionalLong self)`
  Deprecated.
  `static <T> Stream<T>`
  `stream(Spliterator<T> self)`
  Deprecated.
  `static <T> Stream<T>`
  `stream(NullObject self)`
  Deprecated.
  `static <T> Stream<T>`
  `stream(T self)`
  Deprecated.
  `static <T> Stream<T>`
  `stream(T[] self)`
  Deprecated.
  `static <T> T[]`
  `toArray(Stream<? extends T> self, Class<T> type)`
  Deprecated.
  `static <T> List<T>`
  `toList(BaseStream<T,? extends BaseStream> self)`
  Deprecated.
  `static <T> List<T>`
  `toList(Stream<T> self)`
  Deprecated.
  `static <T> Set<T>`
  `toSet(BaseStream<T,? extends BaseStream> self)`
  Deprecated.
  `static <T> Set<T>`
  `toSet(Stream<T> self)`
  Deprecated.

  ### Methods inherited from class org.codehaus.groovy.runtime.DefaultGroovyMethodsSupport

  `cloneSimilarCollection, cloneSimilarMap, closeQuietly, closeWithWarning, createSimilarArray, createSimilarCollection, createSimilarCollection, createSimilarCollection, createSimilarList, createSimilarMap, createSimilarOrDefaultCollection, createSimilarQueue, createSimilarSet, normaliseIndex, sameType, sameType, subListBorders, subListBorders, subListRange, writeUTF16BomIfRequired, writeUTF16BomIfRequired, writeUTF16BomIfRequired, writeUTF16BomIfRequired`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Method Details

  - ### next

    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

  - ### previous

    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

  - ### collect

    public static <S, T> Future<T> collect(Future<S> self, @ClosureParams(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

  - ### asBoolean

    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

  - ### get

    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

  - ### get

    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

  - ### get

    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

  - ### getAt

    public static <T> 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

  - ### peek

    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

  - ### peek

    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

  - ### peek

    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

  - ### peek

    public static <T> 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

  - ### collect

    public static <S, T> Optional<T> collect(Optional<S> self, @ClosureParams(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

  - ### filter

    public static <T> 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

  - ### filter

    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

  - ### filter

    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

  - ### filter

    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

  - ### mapToObj

    public static <T> 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

  - ### mapToObj

    public static <T> 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

  - ### mapToObj

    public static <T> 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

  - ### mapToInt

    public static <T> 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

  - ### mapToLong

    public static <T> 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

  - ### mapToDouble

    public static <T> 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

  - ### orOptional

    public static <T> 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

  - ### getPid

    public static String getPid(Runtime self)
    Gets the pid of the current Java process.
    Since:
      4.0.0

  - ### leftShift

    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

  - ### plus

    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

  - ### putAt

    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

  - ### putAt

    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

  - ### size

    @Deprecated public static int size(StringBuilder self)
    Deprecated.
    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(CharSequence)`

  - ### stream

    @Deprecated public static <T> Stream<T> stream(T self)
    Deprecated.
    Returns a single-element stream for the supplied object.
    Type Parameters:
      `T` - the element type
    Parameters:
      `self` - the source element
    Returns:
      a stream containing `self`

  - ### stream

    @Deprecated public static <T> Stream<T> stream(T[] self)
    Deprecated.
    Returns a stream over the supplied array.
    Type Parameters:
      `T` - the element type
    Parameters:
      `self` - the source array
    Returns:
      a stream over the array contents

  - ### stream

    @Deprecated public static Stream<Integer> stream(int[] self)
    Deprecated.
    Returns a boxed stream over the supplied `int` array.
    Parameters:
      `self` - the source array
    Returns:
      a stream over the array contents

  - ### stream

    @Deprecated public static Stream<Long> stream(long[] self)
    Deprecated.
    Returns a boxed stream over the supplied `long` array.
    Parameters:
      `self` - the source array
    Returns:
      a stream over the array contents

  - ### stream

    @Deprecated public static Stream<Double> stream(double[] self)
    Deprecated.
    Returns a boxed stream over the supplied `double` array.
    Parameters:
      `self` - the source array
    Returns:
      a stream over the array contents

  - ### stream

    @Deprecated public static Stream<Character> stream(char[] self)
    Deprecated.
    Returns a boxed stream over the supplied `char` array.
    Parameters:
      `self` - the source array
    Returns:
      a stream over the array contents

  - ### stream

    @Deprecated public static Stream<Byte> stream(byte[] self)
    Deprecated.
    Returns a boxed stream over the supplied `byte` array.
    Parameters:
      `self` - the source array
    Returns:
      a stream over the array contents

  - ### stream

    @Deprecated public static Stream<Short> stream(short[] self)
    Deprecated.
    Returns a boxed stream over the supplied `short` array.
    Parameters:
      `self` - the source array
    Returns:
      a stream over the array contents

  - ### stream

    @Deprecated public static Stream<Boolean> stream(boolean[] self)
    Deprecated.
    Returns a boxed stream over the supplied `boolean` array.
    Parameters:
      `self` - the source array
    Returns:
      a stream over the array contents

  - ### stream

    @Deprecated public static Stream<Float> stream(float[] self)
    Deprecated.
    Returns a boxed stream over the supplied `float` array.
    Parameters:
      `self` - the source array
    Returns:
      a stream over the array contents

  - ### stream

    @Deprecated public static <T> Stream<T> stream(Enumeration<T> self)
    Deprecated.
    Returns a stream over the supplied enumeration.
    Type Parameters:
      `T` - the element type
    Parameters:
      `self` - the source enumeration
    Returns:
      a stream over the enumeration contents

  - ### stream

    @Deprecated public static <T> Stream<T> stream(Iterable<T> self)
    Deprecated.
    Returns a stream over the supplied iterable.
    Type Parameters:
      `T` - the element type
    Parameters:
      `self` - the source iterable
    Returns:
      a stream over the iterable contents

  - ### stream

    @Deprecated public static <T> Stream<T> stream(Iterator<T> self)
    Deprecated.
    Returns a stream over the supplied iterator.
    Type Parameters:
      `T` - the element type
    Parameters:
      `self` - the source iterator
    Returns:
      a stream over the iterator contents

  - ### stream

    @Deprecated public static <T> Stream<T> stream(Spliterator<T> self)
    Deprecated.
    Returns a stream over the supplied spliterator.
    Type Parameters:
      `T` - the element type
    Parameters:
      `self` - the source spliterator
    Returns:
      a stream over the spliterator contents

  - ### stream

    @Deprecated public static <T> Stream<T> stream(NullObject self)
    Deprecated.
    Returns an empty stream for Groovy's null-object sentinel.
    Type Parameters:
      `T` - the element type
    Parameters:
      `self` - the null-object sentinel
    Returns:
      an empty stream

  - ### stream

    @Deprecated public static <T> Stream<T> stream(Optional<T> self)
    Deprecated.
    Returns a stream over the supplied optional value.
    Type Parameters:
      `T` - the element type
    Parameters:
      `self` - the source optional
    Returns:
      a stream containing the optional value when present

  - ### stream

    @Deprecated public static IntStream stream(OptionalInt self)
    Deprecated.
    Returns an `IntStream` over the supplied optional int value.
    Parameters:
      `self` - the source optional int
    Returns:
      a stream containing the optional value when present

  - ### stream

    @Deprecated public static LongStream stream(OptionalLong self)
    Deprecated.
    Returns a `LongStream` over the supplied optional long value.
    Parameters:
      `self` - the source optional long
    Returns:
      a stream containing the optional value when present

  - ### stream

    @Deprecated public static DoubleStream stream(OptionalDouble self)
    Deprecated.
    Returns a `DoubleStream` over the supplied optional double value.
    Parameters:
      `self` - the source optional double
    Returns:
      a stream containing the optional value when present

  - ### intStream

    @Deprecated public static IntStream intStream(int[] self)
    Deprecated.
    Returns an `IntStream` over the supplied `int` array.
    Parameters:
      `self` - the source array
    Returns:
      an int stream over the array contents

  - ### longStream

    @Deprecated public static LongStream longStream(long[] self)
    Deprecated.
    Returns a `LongStream` over the supplied `long` array.
    Parameters:
      `self` - the source array
    Returns:
      a long stream over the array contents

  - ### doubleStream

    @Deprecated public static DoubleStream doubleStream(double[] self)
    Deprecated.
    Returns a `DoubleStream` over the supplied `double` array.
    Parameters:
      `self` - the source array
    Returns:
      a double stream over the array contents

  - ### toArray

    @Deprecated public static <T> T[] toArray(Stream<? extends T> self, Class<T> type)
    Deprecated.
    Collects the stream elements into a typed array.
    Type Parameters:
      `T` - the element type
    Parameters:
      `self` - the source stream
      `type` - the component type of the target array
    Returns:
      an array containing the stream elements

  - ### toList

    @Deprecated public static <T> List<T> toList(Stream<T> self)
    Deprecated.
    Collects the stream elements into a list.
    Type Parameters:
      `T` - the element type
    Parameters:
      `self` - the source stream
    Returns:
      a list containing the stream elements

  - ### toList

    @Deprecated public static <T> List<T> toList(BaseStream<T,? extends BaseStream> self)
    Deprecated.
    Collects the base-stream elements into a list.
    Type Parameters:
      `T` - the element type
    Parameters:
      `self` - the source base stream
    Returns:
      a list containing the stream elements

  - ### toSet

    @Deprecated public static <T> Set<T> toSet(Stream<T> self)
    Deprecated.
    Collects the stream elements into a set.
    Type Parameters:
      `T` - the element type
    Parameters:
      `self` - the source stream
    Returns:
      a set containing the stream elements

  - ### toSet

    @Deprecated public static <T> Set<T> toSet(BaseStream<T,? extends BaseStream> self)
    Deprecated.
    Collects the base-stream elements into a set.
    Type Parameters:
      `T` - the element type
    Parameters:
      `self` - the source base stream
    Returns:
      a set containing the stream elements