/libcore/ojluni/src/test/java/util/stream/test/org/openjdk/tests/java/util/stream/ |
D | ConcatOpTest.java | 35 import java.util.stream.LongStream; 53 s -> LongStream.concat(s, data.stream().mapToLong(Integer::longValue)), in testOps() 59 LongStream.range(0, Long.MAX_VALUE / 2).boxed(), in testSize() 60 LongStream.range(0, Long.MAX_VALUE / 2).boxed())); in testSize() 63 LongStream.range(0, Long.MAX_VALUE).boxed(), in testSize() 64 LongStream.range(0, Long.MAX_VALUE).boxed())); in testSize() 67 LongStream.range(0, Long.MAX_VALUE).boxed(), in testSize() 72 LongStream.range(0, Long.MAX_VALUE).boxed())); in testSize() 76 assertSized(LongStream.concat( in testLongSize() 77 LongStream.range(0, Long.MAX_VALUE / 2), in testLongSize() [all …]
|
D | LongPrimitiveOpsTests.java | 34 import java.util.stream.LongStream; 42 long sum = LongStream.range(1, 10).filter(i -> i % 2 == 0).sum(); in testSum() 47 long sum = LongStream.range(1, 10).filter(i -> i % 2 == 0).map(i -> i * 2).sum(); in testMap() 52 long sum = LongStream.range(1, 10).parallel().filter(i -> i % 2 == 0).sum(); in testParSum() 59 …long sum = LongStream.range(1, 10).filter(i -> i % 2 == 0).peek(i -> { teeSum[0] = teeSum[0] + i; … in testTee() 66 LongStream.range(1, 10).filter(i -> i % 2 == 0).forEach(i -> { sum[0] = sum[0] + i; }); in testForEach() 73 LongStream.range(1, 10).parallel().filter(i -> i % 2 == 0).forEach(ai::addAndGet); in testParForEach() 78 List<Long> l = LongStream.range(1, 10).parallel().boxed().collect(Collectors.toList()); in testBox() 90 long[] array = LongStream.range(1, 10).map(i -> i * 2).toArray(); in testToArray() 95 long[] array = LongStream.range(1, 10).parallel().map(i -> i * 2).toArray(); in testToArray() [all …]
|
D | CountLargeTest.java | 32 import java.util.stream.LongStream; 44 long count = LongStream.range(0, EXPECTED_LARGE_COUNT) in testRefLarge() 51 long count = LongStream.range(0, EXPECTED_LARGE_COUNT) in testIntLarge() 58 long count = LongStream.range(0, EXPECTED_LARGE_COUNT) in testLongLarge() 65 long count = LongStream.range(0, EXPECTED_LARGE_COUNT) in testDoubleLarge()
|
D | StreamBuilderTest.java | 39 import java.util.stream.LongStream; 202 () -> LongStream.of(1)); in testLongSingleton() 217 LongStream.Builder sb = LongStream.builder(); in testLongAfterBuilding() 218 LongStream.range(0, size).forEach(sb); in testLongAfterBuilding() 229 LongStream.Builder sb = LongStream.builder(); in testLongStreamBuilder() 230 LongStream.range(0, s).forEach(sb); in testLongStreamBuilder() 235 LongStream.Builder sb = LongStream.builder(); in testLongStreamBuilder() 236 LongStream.range(0, s).forEach(i -> { in testLongStreamBuilder() 237 LongStream.Builder _sb = sb.add(i); in testLongStreamBuilder() 244 private void testLongStreamBuilder(int size, Function<Integer, LongStream> supplier) { in testLongStreamBuilder() [all …]
|
D | MinMaxTest.java | 40 import java.util.stream.LongStream; 81 assertEquals(LongStream.empty().min(), OptionalLong.empty()); in testLongMinMax() 82 assertEquals(LongStream.empty().max(), OptionalLong.empty()); in testLongMinMax() 83 assertEquals(1, LongStream.range(1, 1001).min().getAsLong()); in testLongMinMax() 84 assertEquals(1000, LongStream.range(1, 1001).max().getAsLong()); in testLongMinMax() 96 assertEquals(1.0, LongStream.range(1, 1001).asDoubleStream().min().getAsDouble()); in testDoubleMinMax() 97 assertEquals(1000.0, LongStream.range(1, 1001).asDoubleStream().max().getAsDouble()); in testDoubleMinMax()
|
D | RangeTest.java | 33 import java.util.stream.LongStream; 161 long[] inc = LongStream.range(start, end).toArray(); in testLongRange() 181 long[] inc = LongStream.rangeClosed(start, end).toArray(); in testLongRange() 192 long[] inc = LongStream.rangeClosed(Long.MAX_VALUE - 1, Long.MAX_VALUE).toArray(); in testLongRange() 197 inc = LongStream.rangeClosed(Long.MAX_VALUE, Long.MAX_VALUE).toArray(); in testLongRange() 202 () -> LongStream.rangeClosed(Long.MAX_VALUE - 8, Long.MAX_VALUE).spliterator()); in testLongRange() 207 return TestData.Factory.ofLongSupplier("long range", () -> LongStream.range(start, end)); 211 …return TestData.Factory.ofLongSupplier("long rangeClosed", () -> LongStream.rangeClosed(start, end… in longRangeClosedData() 221 "long range", () -> LongStream.iterate(0, i -> i + 1).limit(10000))). in testLongInfiniteRangeLimit() 226 … long first = LongStream.iterate(0, i -> i + 1).filter(i -> i > 10000).findFirst().getAsLong(); in testLongInfiniteRangeFindFirst() [all …]
|
D | MatchOpTest.java | 48 import java.util.stream.LongStream; 261 private final Map<Kind, Function<LongPredicate, Function<LongStream, Boolean>>> longKinds 262 = new HashMap<Kind, Function<LongPredicate, Function<LongStream, Boolean>>>() {{ 268 …private void assertLongPredicates(Supplier<LongStream> source, Kind kind, LongPredicate[] predicat… in assertLongPredicates() 277 …assertLongPredicates(() -> LongStream.range(0, 0), Kind.ANY, LONG_PREDICATES, false, false, false,… in testLongStreamMatches() 278 …assertLongPredicates(() -> LongStream.range(0, 0), Kind.ALL, LONG_PREDICATES, true, true, true, tr… in testLongStreamMatches() 279 …assertLongPredicates(() -> LongStream.range(0, 0), Kind.NONE, LONG_PREDICATES, true, true, true, t… in testLongStreamMatches() 281 …assertLongPredicates(() -> LongStream.range(1, 2), Kind.ANY, LONG_PREDICATES, true, false, false, … in testLongStreamMatches() 282 …assertLongPredicates(() -> LongStream.range(1, 2), Kind.ALL, LONG_PREDICATES, true, false, false, … in testLongStreamMatches() 283 …assertLongPredicates(() -> LongStream.range(1, 2), Kind.NONE, LONG_PREDICATES, false, true, true, … in testLongStreamMatches() [all …]
|
D | SortedOpTest.java | 43 import java.util.stream.LongStream; 58 Function<LongStream, Stream<Long>> f = s -> in testRefStreamTooLarge() 67 Function<LongStream, IntStream> f = s -> in testIntStreamTooLarge() 76 Function<LongStream, LongStream> f = s -> in testLongStreamTooLarge() 81 testStreamTooLarge(f, LongStream::findFirst); in testLongStreamTooLarge() 85 Function<LongStream, DoubleStream> f = s -> in testDoubleStreamTooLarge() 93 <T, S extends BaseStream<T, S>> void testStreamTooLarge(Function<LongStream, S> s, in testStreamTooLarge() argument 96 Supplier<LongStream> input = () -> LongStream.range(0, 1L + Integer.MAX_VALUE); in testStreamTooLarge() 99 List<Function<LongStream, LongStream>> transforms = Arrays.asList( in testStreamTooLarge() 106 for (Function<LongStream, LongStream> transform : transforms) { in testStreamTooLarge() [all …]
|
D | DoublePrimitiveOpsTests.java | 31 import java.util.stream.LongStream; 47 double[] array = LongStream.range(1, 10).asDoubleStream().map(i -> i * 2).toArray(); in testToArray() 52 … double[] array = LongStream.range(1, 10).parallel().asDoubleStream().map(i -> i * 2).toArray(); in testToArray() 102 … double[] actual = LongStream.range(1, 100).parallel().asDoubleStream().limit(9).toArray(); in testLimit()
|
D | StreamSpliteratorTest.java | 46 import java.util.stream.LongStream; 435 List<Consumer<LongStream>> terminalOps = Arrays.asList( in testLongSplitting() 441 List<UnaryOperator<LongStream>> intermediateOps = Arrays.asList( in testLongSplitting() 448 Consumer<LongStream> terminalOp = terminalOps.get(i); in testLongSplitting() 452 UnaryOperator<LongStream> intermediateOp = intermediateOps.get(j); in testLongSplitting() 457 … Spliterator.OfLong sp = intermediateOp.apply(LongStream.range(0, 1000)).spliterator(); in testLongSplitting() 459 LongStream s = StreamSupport.longStream(psp, true); in testLongSplitting() 479 for (Function<LongStream, LongStream> f : longStreamFunctions()) { 482 LongStream out = f.apply(in); 489 LongStream out = f.apply(in); [all …]
|
D | InfiniteStreamWithLimitOpTest.java | 47 import java.util.stream.LongStream; 95 (UnaryOperator<LongStream>) s -> s.limit(SKIP_LIMIT_SIZE)}); in longSliceFunctionsDataProvider() 97 (UnaryOperator<LongStream>) s -> s.skip(SKIP_LIMIT_SIZE).limit(SKIP_LIMIT_SIZE)}); in longSliceFunctionsDataProvider() 143 () -> LongStream.range(l, u).boxed()); 163 () -> LongStream.range(l, u)); 173 () -> LongStream.range(l, u).mapToDouble(i -> (double) i)); 202 public void testLongSubsizedWithRange(String description, UnaryOperator<LongStream> fs) { 249 public void testLongUnorderedFinite(String description, UnaryOperator<LongStream> fs) { 303 … () -> StreamSupport.longStream(proxyNotSubsized(LongStream.range(l, u).spliterator()), false)); 331 …ic void testLongUnorderedSizedNotSubsizedFinite(String description, UnaryOperator<LongStream> fs) { [all …]
|
D | ToArrayOpTest.java | 40 import java.util.stream.LongStream; 305 long[] longs = exerciseTerminalOps(data, s -> s.sorted(), (LongStream s) -> s.toArray()); 328 private List<Function<LongStream, LongStream>> longUniqueAndSortedPermutations = 338 for (Function<LongStream, LongStream> f : longUniqueAndSortedPermutations) { 343 private List<Function<LongStream, LongStream>> longStatefulOpPermutations = 352 for (Function<LongStream, LongStream> f : longStatefulOpPermutations) {
|
D | ExplodeOpTest.java | 42 import java.util.stream.LongStream; 110 result = exerciseOps(data, s -> LongStream.empty()); in testLongOps() 113 exerciseOps(data, s -> s.flatMap(e -> LongStream.range(0, e))); in testLongOps() 114 exerciseOps(data, s -> s.flatMap(e -> LongStream.range(0, e).limit(10))); in testLongOps()
|
D | CountTest.java | 43 import java.util.stream.LongStream; 78 terminal(LongStream::count). in testOps()
|
D | ForEachOpTest.java | 45 import java.util.stream.LongStream; 185 () -> LongStream.range(1, 10001)); 187 Function<LongStream, List<Integer>> terminalFunc = s -> { 208 Function<LongStream, List<Long>> terminalFunc = s -> {
|
/libcore/ojluni/src/main/java/java/util/stream/ |
D | LongStream.java | 77 public interface LongStream extends BaseStream<Long, LongStream> { interface 92 LongStream filter(LongPredicate predicate); in filter() 106 LongStream map(LongUnaryOperator mapper); in map() 169 LongStream flatMap(LongFunction<? extends LongStream> mapper); in flatMap() 179 LongStream distinct(); in distinct() 190 LongStream sorted(); in sorted() 221 LongStream peek(LongConsumer action); in peek() 248 LongStream limit(long maxSize); in limit() 277 LongStream skip(long n); in skip() 666 LongStream sequential(); in sequential() [all …]
|
D | LongPipeline.java | 56 extends AbstractPipeline<E_IN, Long, LongStream> 57 implements LongStream { 206 public final LongStream map(LongUnaryOperator mapper) { 274 public final LongStream flatMap(LongFunction<? extends LongStream> mapper) { 287 try (LongStream result = mapper.apply(t)) { 299 public LongStream unordered() { 311 public final LongStream filter(LongPredicate predicate) { 334 public final LongStream peek(LongConsumer action) { 354 public final LongStream limit(long maxSize) { 361 public final LongStream skip(long n) { [all …]
|
D | StreamSupport.java | 204 public static LongStream longStream(Spliterator.OfLong spliterator, in longStream() 243 public static LongStream longStream(Supplier<? extends Spliterator.OfLong> supplier, in longStream()
|
D | Stream.java | 209 LongStream mapToLong(ToLongFunction<? super T> mapper); in mapToLong() 307 LongStream flatMapToLong(Function<? super T, ? extends LongStream> mapper); in flatMapToLong()
|
/libcore/ojluni/src/test/java/util/stream/testlib/org/openjdk/testlib/java/util/stream/ |
D | LongStreamTestScenario.java | 51 void _run(TestData<T, S_IN> data, LongConsumer b, Function<S_IN, LongStream> m) { in STREAM_FOR_EACH_WITH_CLOSE() 52 LongStream s = m.apply(data.stream()); in STREAM_FOR_EACH_WITH_CLOSE() 63 void _run(TestData<T, S_IN> data, LongConsumer b, Function<S_IN, LongStream> m) { in STREAM_TO_ARRAY() 72 void _run(TestData<T, S_IN> data, LongConsumer b, Function<S_IN, LongStream> m) { in STREAM_ITERATOR() 81 void _run(TestData<T, S_IN> data, LongConsumer b, Function<S_IN, LongStream> m) { in STREAM_SPLITERATOR() 90 void _run(TestData<T, S_IN> data, LongConsumer b, Function<S_IN, LongStream> m) { in STREAM_SPLITERATOR_WITH_MIXED_TRAVERSE_AND_SPLIT() 98 void _run(TestData<T, S_IN> data, LongConsumer b, Function<S_IN, LongStream> m) { in STREAM_SPLITERATOR_FOREACH() 105 void _run(TestData<T, S_IN> data, LongConsumer b, Function<S_IN, LongStream> m) { in PAR_STREAM_SEQUENTIAL_FOR_EACH() 113 void _run(TestData<T, S_IN> data, LongConsumer b, Function<S_IN, LongStream> m) { in PAR_STREAM_FOR_EACH_ORDERED() 122 void _run(TestData<T, S_IN> data, LongConsumer b, Function<S_IN, LongStream> m) { in PAR_STREAM_SPLITERATOR() [all …]
|
D | LongStreamTestDataProvider.java | 101 () -> LongStream.range(0, longs.length))); 103 () -> LongStream.rangeClosed(0, longs.length))); 133 () -> LongStream.range(0, longs.length).spliterator())); 135 … () -> LongStream.rangeClosed(0, longs.length).spliterator())); 143 static <T> Object[] streamDataDescr(String description, Supplier<LongStream> s) { in streamDataDescr()
|
/libcore/ojluni/src/test/java/util/stream/bootlib/java/util/stream/ |
D | LongStreamTestScenario.java | 48 void _run(TestData<T, S_IN> data, LongConsumer b, Function<S_IN, LongStream> m) { in STREAM_FOR_EACH_WITH_CLOSE() 49 LongStream s = m.apply(data.stream()); in STREAM_FOR_EACH_WITH_CLOSE() 60 void _run(TestData<T, S_IN> data, LongConsumer b, Function<S_IN, LongStream> m) { in STREAM_TO_ARRAY() 69 void _run(TestData<T, S_IN> data, LongConsumer b, Function<S_IN, LongStream> m) { in STREAM_ITERATOR() 78 void _run(TestData<T, S_IN> data, LongConsumer b, Function<S_IN, LongStream> m) { in STREAM_SPLITERATOR() 87 void _run(TestData<T, S_IN> data, LongConsumer b, Function<S_IN, LongStream> m) { in STREAM_SPLITERATOR_WITH_MIXED_TRAVERSE_AND_SPLIT() 95 void _run(TestData<T, S_IN> data, LongConsumer b, Function<S_IN, LongStream> m) { in STREAM_SPLITERATOR_FOREACH() 102 void _run(TestData<T, S_IN> data, LongConsumer b, Function<S_IN, LongStream> m) { in PAR_STREAM_SEQUENTIAL_FOR_EACH() 110 void _run(TestData<T, S_IN> data, LongConsumer b, Function<S_IN, LongStream> m) { in PAR_STREAM_FOR_EACH_ORDERED() 119 void _run(TestData<T, S_IN> data, LongConsumer b, Function<S_IN, LongStream> m) { in PAR_STREAM_SPLITERATOR() [all …]
|
D | LongStreamTestDataProvider.java | 97 () -> LongStream.range(0, longs.length))); 99 () -> LongStream.rangeClosed(0, longs.length))); 129 () -> LongStream.range(0, longs.length).spliterator())); 131 … () -> LongStream.rangeClosed(0, longs.length).spliterator())); 139 static <T> Object[] streamDataDescr(String description, Supplier<LongStream> s) { in streamDataDescr()
|
/libcore/ojluni/src/test/java/util/stream/boottest/java/util/stream/ |
D | StreamReuseTest.java | 267 … (LongStream s) -> s.mapToObj(i -> i), (LongStream s) -> s.mapToObj(i -> i), in testTwoStreams() 271 LongStream::distinct, (LongStream s) -> s.mapToObj(i -> i), in testTwoStreams() 275 (LongStream s) -> s.mapToObj(i -> i), LongStream::distinct, in testTwoStreams() 279 LongStream::distinct, LongStream::distinct, in testTwoStreams() 287 LongStream::sum, LongStream::sum, in testTwoTerminals() 295 LongStream::sum, (LongStream s) -> s.mapToObj(i -> i), in testTerminalStream() 299 (LongStream s) -> s.mapToObj(i -> i), LongStream::sum, in testTerminalStream() 303 LongStream::sum, LongStream::distinct, in testTerminalStream() 307 LongStream::distinct, LongStream::sum, in testTerminalStream() 315 LongStream::iterator, LongStream::iterator, in testTwoIterators() [all …]
|
D | SliceSpliteratorTest.java | 100 … final Collection<Long> source = LongStream.range(0, size).boxed().collect(toList()); in sliceSpliteratorDataProvider() 113 …final Collection<Double> source = LongStream.range(0, size).asDoubleStream().boxed().collect(toLi… in sliceSpliteratorDataProvider() 157 … final Collection<Long> source = LongStream.range(0, size).boxed().collect(toList()); in sliceSpliteratorDataProvider() 171 …final Collection<Double> source = LongStream.range(0, size).asDoubleStream().boxed().collect(toLi… in sliceSpliteratorDataProvider() 175 … Spliterator.OfDouble s = Arrays.spliterator(LongStream.range(0, SIZE).asDoubleStream().toArray()); in sliceSpliteratorDataProvider()
|