Java Code Examples for java.util.stream.LongStream#of()
The following examples show how to use
java.util.stream.LongStream#of() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ArrayStreamLinkerExporter.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public static Object arrayToStream(final Object array) { if (array instanceof int[]) { return IntStream.of((int[])array); } else if (array instanceof long[]) { return LongStream.of((long[])array); } else if (array instanceof double[]) { return DoubleStream.of((double[])array); } else if (array instanceof Object[]) { return Stream.of((Object[])array); } else { throw new IllegalArgumentException(); } }
Example 2
Source File: PluginDefaultGroovyMethods.java From groovy with Apache License 2.0 | 5 votes |
/** * If a value is present in the {@link OptionalLong}, returns a {@link LongStream} * with the value as its source or else an empty stream. * * @since 3.0.0 */ public static LongStream stream(final OptionalLong self) { if (!self.isPresent()) { return LongStream.empty(); } return LongStream.of(self.getAsLong()); }
Example 3
Source File: MethodSourcePrimitiveTypesParameterizedTest.java From mastering-junit5 with Apache License 2.0 | 4 votes |
static LongStream longProvider() { return LongStream.of(4L, 5L); }
Example 4
Source File: MethodSourcePrimitiveTypesParameterizedTest.java From Mastering-Software-Testing-with-JUnit-5 with MIT License | 4 votes |
static LongStream longProvider() { return LongStream.of(4L, 5L); }
Example 5
Source File: LongArraySimpledCoder.java From redkale with Apache License 2.0 | 4 votes |
@Override @SuppressWarnings("unchecked") public LongStream convertFrom(R in) { long[] value = LongArraySimpledCoder.instance.convertFrom(in); return value == null ? null : LongStream.of(value); }
Example 6
Source File: MutableLong.java From cyclops with Apache License 2.0 | 4 votes |
public LongStream toLongStream() { return LongStream.of(var); }
Example 7
Source File: NumberUtils.java From ApprovalTests.Java with Apache License 2.0 | 4 votes |
public static LongStream toLongStream(long[] numbers) { return LongStream.of(numbers); }
Example 8
Source File: OptionalLong.java From Bytecoder with Apache License 2.0 | 3 votes |
/** * If a value is present, returns a sequential {@link LongStream} containing * only that value, otherwise returns an empty {@code LongStream}. * * @apiNote * This method can be used to transform a {@code Stream} of optional longs * to an {@code LongStream} of present longs: * <pre>{@code * Stream<OptionalLong> os = .. * LongStream s = os.flatMapToLong(OptionalLong::stream) * }</pre> * * @return the optional value as an {@code LongStream} * @since 9 */ public LongStream stream() { if (isPresent) { return LongStream.of(value); } else { return LongStream.empty(); } }
Example 9
Source File: OptionalLong.java From openjdk-jdk9 with GNU General Public License v2.0 | 3 votes |
/** * If a value is present, returns a sequential {@link LongStream} containing * only that value, otherwise returns an empty {@code LongStream}. * * @apiNote * This method can be used to transform a {@code Stream} of optional longs * to an {@code LongStream} of present longs: * <pre>{@code * Stream<OptionalLong> os = .. * LongStream s = os.flatMapToLong(OptionalLong::stream) * }</pre> * * @return the optional value as an {@code LongStream} * @since 9 */ public LongStream stream() { if (isPresent) { return LongStream.of(value); } else { return LongStream.empty(); } }
Example 10
Source File: ConcatenateStream.java From levelup-java-examples with Apache License 2.0 | 3 votes |
@Test public void join_longstreamstream() { LongStream longStream1 = LongStream.of(5, 6); LongStream longStream2 = LongStream.of(7, 8); LongStream.concat(longStream1, longStream2).forEach( e -> System.out.println(e)); }
Example 11
Source File: LongArray.java From Strata with Apache License 2.0 | 2 votes |
/** * Returns a stream over the array values. * * @return a stream over the values in the array */ public LongStream stream() { return LongStream.of(array); }