Example usage for java.util.stream DoubleStream forEach

List of usage examples for java.util.stream DoubleStream forEach

Introduction

In this page you can find the example usage for java.util.stream DoubleStream forEach.

Prototype

void forEach(DoubleConsumer action);

Source Link

Document

Performs an action for each element of this stream.

Usage

From source file:Main.java

public static void main(String[] args) {
    DoubleStream d = DoubleStream.of(1.2, 4.5, 1.2, 2.3);

    DoubleStream r = d.sorted();

    r.forEach(System.out::println);
}

From source file:Main.java

public static void main(String[] args) {
    DoubleStream.Builder b = DoubleStream.builder();
    b.accept(1.2);/*from w  w  w . j ava 2  s .  co  m*/
    b.accept(1.2);
    b.accept(1.2);
    DoubleStream d = b.build();
    d.forEach(System.out::println);
}

From source file:Main.java

public static void main(String[] args) {
    DoubleStream d = DoubleStream.of(1.2, 1.2, 2.3, 4.5);

    DoubleStream r = d.distinct();

    r.forEach(System.out::println);
}

From source file:Main.java

public static void main(String[] args) {
    IntStream i = IntStream.of(6, 5, 7, 1, 2, 3, 4);
    DoubleStream d = i.asDoubleStream();
    d.forEach(System.out::println);
}

From source file:Main.java

public static void main(String[] args) {
    DoubleStream d = DoubleStream.of(1.2);

    d.forEach(System.out::println);

}

From source file:Main.java

public static void main(String[] args) {
    IntStream i = IntStream.of(6, 5, 7, 1, 2, 3, 3);
    DoubleStream d = i.mapToDouble(Math::sin);
    d.forEach(System.out::println);
}

From source file:Main.java

public static void main(String[] args) {
    DoubleStream d = DoubleStream.of(1.2, 2.3, 4.5);
    d.forEach(System.out::println);

}

From source file:Main.java

public static void main(String[] args) {
    DoubleStream d = DoubleStream.of(1.2, 2.3, 4.5);

    d.forEach(System.out::println);

}

From source file:com.simiacryptus.mindseye.lang.Tensor.java

/**
 * Get doubles double [ ].//from w  ww  .j a  v  a2 s.c  o m
 *
 * @param stream the stream
 * @param dim    the length
 * @return the double [ ]
 */
public static double[] getDoubles(@Nonnull final DoubleStream stream, final int dim) {
    final double[] doubles = RecycleBin.DOUBLES.obtain(dim);
    stream.forEach(new DoubleConsumer() {
        int j = 0;

        @Override
        public void accept(final double value) {
            doubles[j++] = value;
        }
    });
    return doubles;
}

From source file:org.terracotta.statistics.derived.histogram.BarSplittingBiasedHistogramFittingTest.java

@Override
protected Histogram histogram(double bias, int bars, DoubleStream data) {
    BarSplittingBiasedHistogram bsbh = new BarSplittingBiasedHistogram(bias, bars, Long.MAX_VALUE);
    data.forEach(d -> bsbh.event(d, 0));
    return bsbh;//from  ww  w.  ja va 2 s.  c o  m
}