Home
last modified time | relevance | path

Searched refs:reduce (Results 1 – 25 of 40) sorted by relevance

12

/libcore/ojluni/src/test/java/util/stream/test/org/openjdk/tests/java/util/stream/
DReduceTest.java47 assertEquals(55, (int) list.stream().reduce(rPlus).get()); in testReduce()
48 assertEquals(55, (int) list.stream().reduce(0, rPlus)); in testReduce()
49 assertEquals(10, (int) list.stream().reduce(rMax).get()); in testReduce()
50 assertEquals(1, (int) list.stream().reduce(rMin).get()); in testReduce()
52 assertEquals(0, (int) countTo(0).stream().reduce(0, rPlus)); in testReduce()
53 assertTrue(!countTo(0).stream().reduce(rPlus).isPresent()); in testReduce()
55 assertEquals(110, (int) list.stream().map(mDoubler).reduce(rPlus).get()); in testReduce()
56 assertEquals(20, (int) list.stream().map(mDoubler).reduce(rMax).get()); in testReduce()
57 assertEquals(2, (int) list.stream().map(mDoubler).reduce(rMin).get()); in testReduce()
62 …assertEquals(0, (int) exerciseTerminalOps(data, s -> s.filter(pFalse), s -> s.reduce(0, rPlus, rPl… in testOps()
[all …]
DIntReduceTest.java41 assertEquals(55, Arrays.stream(a).reduce(irPlus).getAsInt()); in testReduce()
42 assertEquals(55, Arrays.stream(a).reduce(0, irPlus)); in testReduce()
43 assertEquals(10, Arrays.stream(a).reduce(irMax).getAsInt()); in testReduce()
44 assertEquals(1, Arrays.stream(a).reduce(irMin).getAsInt()); in testReduce()
46 assertEquals(0, IntStream.empty().reduce(0, irPlus)); in testReduce()
47 assertFalse(IntStream.empty().reduce(irPlus).isPresent()); in testReduce()
49 assertEquals(110, Arrays.stream(a).map(irDoubler).reduce(irPlus).getAsInt()); in testReduce()
50 assertEquals(20, Arrays.stream(a).map(irDoubler).reduce(irMax).getAsInt()); in testReduce()
51 assertEquals(2, Arrays.stream(a).map(irDoubler).reduce(irMin).getAsInt()); in testReduce()
56 …assertEquals(0, (int) exerciseTerminalOps(data, s -> s.filter(ipFalse), s -> s.reduce(0, irPlus))); in testOps()
[all …]
DPrimitiveSumTest.java49 expectedResult(data.stream().asLongStream().reduce(0, LambdaTestHelpers.lrPlus)). in testOps()
59 expectedResult(data.stream().reduce(0, LambdaTestHelpers.lrPlus)). in testOps()
73 expectedResult(data.stream().reduce(0, LambdaTestHelpers.drPlus)). in testOps()
DWhileOpStatefulTest.java74 .mapToLong(e -> 1).reduce(0, Long::sum); in testTimedTakeWithCount()
106 .mapToLong(e -> 1).reduce(0, Long::sum); in testCountTakeWithCount()
173 .mapToLong(e -> 1).reduce(0, Long::sum); in testCountDropWithCount()
DTabulatorsTest.java136 .reduce(mergeFn) in assertValue()
222 Optional<U> reduced = source.get().map(mapper).reduce(reducer); in assertValue()
290 s -> s.reduce(0, Integer::sum));
297 s -> s.reduce(Integer::sum));
304 s -> s.map(x -> x*2).reduce(0, Integer::sum));
307 s -> s.map(x -> x*2L).reduce(0L, Long::sum));
309 s -> s.map(x -> x*2).reduce(0, Integer::sum));
311 s -> s.map(x -> x * 2.0d).reduce(0.0d, Double::sum));
DRangeTest.java133 terminal(s -> s.reduce(0, Integer::sum)).exercise(); in tesIntRangeReduce()
139 terminal(s -> s.reduce(0, Integer::sum)).exercise(); in testIntInfiniteRangeLimit()
216 terminal(s -> s.reduce(0, Long::sum)).exercise(); in testLongRangeReduce()
222 terminal(s -> s.reduce(0, Long::sum)).exercise(); in testLongInfiniteRangeLimit()
DCollectorsTest.java196 .reduce(mergeFn) in assertValue()
280 Optional<U> reduced = source.get().map(mapper).reduce(reducer); in assertValue()
369 s -> s.reduce(0, Integer::sum));
376 s -> s.reduce(Integer::sum));
383 s -> s.map(x -> x*2).reduce(0, Integer::sum));
386 s -> s.map(x -> x*2L).reduce(0L, Long::sum));
388 s -> s.map(x -> x*2).reduce(0, Integer::sum));
390 s -> s.map(x -> x * 2.0d).reduce(0.0d, Double::sum));
DReduceByOpTest.java57 … assertEquals(entry.getValue(), data.stream().filter(e -> pEven.test(e) == key).reduce(0, rPlus)); in testOps()
/libcore/ojluni/src/test/java/util/stream/testlib/org/openjdk/testlib/java/util/stream/
DDefaultMethodStreams.java282 public T reduce(T identity, BinaryOperator<T> accumulator) { in reduce() method in DefaultMethodStreams.DefaultMethodRefStream
283 return s.reduce(identity, accumulator); in reduce()
287 public Optional<T> reduce(BinaryOperator<T> accumulator) { in reduce() method in DefaultMethodStreams.DefaultMethodRefStream
288 return s.reduce(accumulator); in reduce()
292 …public <U> U reduce(U identity, BiFunction<U, ? super T, U> accumulator, BinaryOperator<U> combine… in reduce() method in DefaultMethodStreams.DefaultMethodRefStream
293 return s.reduce(identity, accumulator, combiner); in reduce()
468 public int reduce(int identity, IntBinaryOperator op) { in reduce() method in DefaultMethodStreams.DefaultMethodIntStream
469 return s.reduce(identity, op); in reduce()
473 public OptionalInt reduce(IntBinaryOperator op) { in reduce() method in DefaultMethodStreams.DefaultMethodIntStream
474 return s.reduce(op); in reduce()
[all …]
/libcore/ojluni/src/test/java/lang/StackWalker/
DWalkFunction.java60 Optional<StackFrame> result = walker.walk(WalkFunction::reduce); in testFunctions()
66 static Optional<StackFrame> reduce(Stream<StackFrame> stream) { in reduce() method in WalkFunction
69 return stream.reduce((r,f) -> { in reduce()
/libcore/ojluni/src/main/java/java/util/stream/
DDistinctOps.java58 <P_IN> Node<T> reduce(PipelineHelper<T> helper, Spliterator<P_IN> spliterator) { in makeRef()
77 return reduce(helper, spliterator); in makeRef()
112 return reduce(helper, spliterator).spliterator(); in makeRef()
DIntPipeline.java491 return reduce(0, Integer::sum);
496 return reduce(Math::min);
501 return reduce(Math::max);
532 public final int reduce(int identity, IntBinaryOperator op) {
537 public final OptionalInt reduce(IntBinaryOperator op) {
DLongPipeline.java474 return reduce(0, Long::sum);
479 return reduce(Math::min);
484 return reduce(Math::max);
515 public final long reduce(long identity, LongBinaryOperator op) {
520 public final OptionalLong reduce(LongBinaryOperator op) {
DStream.java961 T reduce(T identity, BinaryOperator<T> accumulator);
1001 Optional<T> reduce(BinaryOperator<T> accumulator);
1050 <U> U reduce(U identity,
DDoublePipeline.java484 return reduce(Math::min);
489 return reduce(Math::max);
540 public final double reduce(double identity, DoubleBinaryOperator op) {
545 public final OptionalDouble reduce(DoubleBinaryOperator op) {
DReferencePipeline.java680 public final P_OUT reduce(final P_OUT identity, final BinaryOperator<P_OUT> accumulator) {
685 public final Optional<P_OUT> reduce(BinaryOperator<P_OUT> accumulator) {
690 …public final <R> R reduce(R identity, BiFunction<R, ? super P_OUT, R> accumulator, BinaryOperator<…
722 return reduce(BinaryOperator.maxBy(comparator));
727 return reduce(BinaryOperator.minBy(comparator));
DDoubleStream.java547 double reduce(double identity, DoubleBinaryOperator op); in reduce() method
584 OptionalDouble reduce(DoubleBinaryOperator op); in reduce() method
DIntStream.java544 int reduce(int identity, IntBinaryOperator op); in reduce() method
581 OptionalInt reduce(IntBinaryOperator op); in reduce() method
DLongStream.java545 long reduce(long identity, LongBinaryOperator op); in reduce() method
582 OptionalLong reduce(LongBinaryOperator op); in reduce() method
/libcore/ojluni/src/test/java/util/stream/Collectors/
DCollectorsTest.java199 .reduce(mergeFn) in assertValue()
283 Optional<U> reduced = source.get().map(mapper).reduce(reducer); in assertValue()
351 s -> s.reduce(0, Integer::sum));
358 s -> s.reduce(Integer::sum));
365 s -> s.map(x -> x*2).reduce(0, Integer::sum));
368 s -> s.map(x -> x*2L).reduce(0L, Long::sum));
370 s -> s.map(x -> x*2).reduce(0, Integer::sum));
372 s -> s.map(x -> x * 2.0d).reduce(0.0d, Double::sum));
/libcore/ojluni/annotations/flagged_api/java/util/stream/
DDoubleStream.annotated.java68 public double reduce(double identity, java.util.function.DoubleBinaryOperator op); in reduce() method
70 public java.util.OptionalDouble reduce(java.util.function.DoubleBinaryOperator op); in reduce() method
DIntStream.annotated.java68 public int reduce(int identity, java.util.function.IntBinaryOperator op); in reduce() method
70 public java.util.OptionalInt reduce(java.util.function.IntBinaryOperator op); in reduce() method
DLongStream.annotated.java68 public long reduce(long identity, java.util.function.LongBinaryOperator op); in reduce() method
70 public java.util.OptionalLong reduce(java.util.function.LongBinaryOperator op); in reduce() method
/libcore/benchmarks/
DREADME.md17 Extra options to reduce noise:
/libcore/ojluni/src/test/java/util/DoubleStreamSums/
DCompensatedSums.java81 naive += square(DoubleStream.of(rand).reduce((x, y) -> x+y).getAsDouble() - sum[0]); in testCompensatedSums()

12