Package org.codehaus.groovy.vmplugin.v8
Class PluginDefaultGroovyMethods
- java.lang.Object
-
- org.codehaus.groovy.vmplugin.v8.PluginDefaultGroovyMethods
-
public class PluginDefaultGroovyMethods extends Object
Defines new Groovy methods which appear on normal JDK 8 classes inside the Groovy environment.- Since:
- 2.5.0
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
asBoolean(Optional<?> optional)
Coerce an Optional instance to a boolean value.static Stream<Boolean>
stream(boolean[] self)
Returns a sequentialStream
with the specified array as its source.static Stream<Byte>
stream(byte[] self)
Returns a sequentialStream
with the specified array as its source.static Stream<Character>
stream(char[] self)
Returns a sequentialStream
with the specified array as its source.static Stream<Double>
stream(double[] self)
Returns a sequentialStream
with the specified array as its source.static Stream<Float>
stream(float[] self)
Returns a sequentialStream
with the specified array as its source.static Stream<Integer>
stream(int[] self)
Returns a sequentialStream
with the specified array as its source.static Stream<Long>
stream(long[] self)
Returns a sequentialStream
with the specified array as its source.static Stream<Short>
stream(short[] self)
Returns a sequentialStream
with the specified array as its source.static <T> Stream<T>
stream(T[] self)
Returns a sequentialStream
with the specified array as its source.static <T> List<T>
toList(BaseStream<T,? extends BaseStream> stream)
Accumulates the elements of stream into a new List.static <T> List<T>
toList(Stream<T> stream)
Accumulates the elements of stream into a new List.static <T> Set<T>
toSet(BaseStream<T,? extends BaseStream> stream)
Accumulates the elements of stream into a new Set.static <T> Set<T>
toSet(Stream<T> stream)
Accumulates the elements of stream into a new Set.
-
-
-
Method Detail
-
asBoolean
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, otherwisefalse
-
toList
public static <T> List<T> toList(Stream<T> stream)
Accumulates the elements of stream into a new List.- Type Parameters:
T
- the type of element- Parameters:
stream
- the Stream- Returns:
- a new
java.util.List
instance
-
toSet
public static <T> Set<T> toSet(Stream<T> stream)
Accumulates the elements of stream into a new Set.- Type Parameters:
T
- the type of element- Parameters:
stream
- the Stream- Returns:
- a new
java.util.Set
instance
-
toList
public static <T> List<T> toList(BaseStream<T,? extends BaseStream> stream)
Accumulates the elements of stream into a new List.- Type Parameters:
T
- the type of element- Parameters:
stream
- thejava.util.stream.BaseStream
- Returns:
- a new
java.util.List
instance
-
toSet
public static <T> Set<T> toSet(BaseStream<T,? extends BaseStream> stream)
Accumulates the elements of stream into a new Set.- Type Parameters:
T
- the type of element- Parameters:
stream
- thejava.util.stream.BaseStream
- Returns:
- a new
java.util.Set
instance
-
stream
public static <T> Stream<T> stream(T[] self)
Returns a sequentialStream
with the specified array as its source.- Type Parameters:
T
- The type of the array elements- Parameters:
self
- The array, assumed to be unmodified during use- Returns:
- a
Stream
for the array
-
stream
public static Stream<Integer> stream(int[] self)
Returns a sequentialStream
with the specified array as its source.- Parameters:
self
- The array, assumed to be unmodified during use- Returns:
- a
Stream
for the array
-
stream
public static Stream<Long> stream(long[] self)
Returns a sequentialStream
with the specified array as its source.- Parameters:
self
- The array, assumed to be unmodified during use- Returns:
- a
Stream
for the array
-
stream
public static Stream<Double> stream(double[] self)
Returns a sequentialStream
with the specified array as its source.- Parameters:
self
- The array, assumed to be unmodified during use- Returns:
- a
Stream
for the array
-
stream
public static Stream<Character> stream(char[] self)
Returns a sequentialStream
with the specified array as its source.- Parameters:
self
- The array, assumed to be unmodified during use- Returns:
- a
Stream
for the array
-
stream
public static Stream<Byte> stream(byte[] self)
Returns a sequentialStream
with the specified array as its source.- Parameters:
self
- The array, assumed to be unmodified during use- Returns:
- a
Stream
for the array
-
stream
public static Stream<Short> stream(short[] self)
Returns a sequentialStream
with the specified array as its source.- Parameters:
self
- The array, assumed to be unmodified during use- Returns:
- a
Stream
for the array
-
stream
public static Stream<Boolean> stream(boolean[] self)
Returns a sequentialStream
with the specified array as its source.- Parameters:
self
- The array, assumed to be unmodified during use- Returns:
- a
Stream
for the array
-
-