public class PluginDefaultGroovyMethods extends Object
Modifier and Type | Method and Description |
---|---|
static boolean |
asBoolean(Optional<?> optional)
Coerce an Optional instance to a boolean value.
|
static Stream<Boolean> |
stream(boolean[] 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<Character> |
stream(char[] 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<Float> |
stream(float[] 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<Short> |
stream(short[] self)
Returns a sequential
Stream with the specified array as its
source. |
static <T> Stream<T> |
stream(T[] self)
Returns a sequential
Stream 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.
|
public static boolean asBoolean(Optional<?> optional)
optional
- the Optionaltrue
if a value is present, otherwise false
public static <T> List<T> toList(Stream<T> stream)
T
- the type of elementstream
- the Streamjava.util.List
instancepublic static <T> Set<T> toSet(Stream<T> stream)
T
- the type of elementstream
- the Streamjava.util.Set
instancepublic static <T> List<T> toList(BaseStream<T,? extends BaseStream> stream)
T
- the type of elementstream
- the java.util.stream.BaseStream
java.util.List
instancepublic static <T> Set<T> toSet(BaseStream<T,? extends BaseStream> stream)
T
- the type of elementstream
- the java.util.stream.BaseStream
java.util.Set
instancepublic static <T> Stream<T> stream(T[] self)
Stream
with the specified array as its
source.T
- The type of the array elementsself
- The array, assumed to be unmodified during useStream
for the arraypublic static Stream<Integer> stream(int[] self)
Stream
with the specified array as its
source.self
- The array, assumed to be unmodified during useStream
for the arraypublic static Stream<Long> stream(long[] self)
Stream
with the specified array as its
source.self
- The array, assumed to be unmodified during useStream
for the arraypublic static Stream<Double> stream(double[] self)
Stream
with the specified array as its
source.self
- The array, assumed to be unmodified during useStream
for the arraypublic static Stream<Character> stream(char[] self)
Stream
with the specified array as its
source.self
- The array, assumed to be unmodified during useStream
for the arraypublic static Stream<Byte> stream(byte[] self)
Stream
with the specified array as its
source.self
- The array, assumed to be unmodified during useStream
for the arraypublic static Stream<Short> stream(short[] self)
Stream
with the specified array as its
source.self
- The array, assumed to be unmodified during useStream
for the arraypublic static Stream<Boolean> stream(boolean[] self)
Stream
with the specified array as its
source.self
- The array, assumed to be unmodified during useStream
for the array