Example usage for java.util.function DoubleConsumer DoubleConsumer

List of usage examples for java.util.function DoubleConsumer DoubleConsumer

Introduction

In this page you can find the example usage for java.util.function DoubleConsumer DoubleConsumer.

Prototype

DoubleConsumer

Source Link

Usage

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

/**
 * Get doubles double [ ].//from   ww  w  .  j av  a2  s.  co 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;
}