List of usage examples for java.util.function DoubleSupplier getAsDouble
double getAsDouble();
From source file:Main.java
public static void main(String[] args) { DoubleSupplier pi = () -> { return 3.14d; };/*from ww w . jav a 2s . c o m*/ System.out.println(pi.getAsDouble()); }
From source file:com.simiacryptus.util.Util.java
/** * Add./*w w w. ja v a2 s . c o m*/ * * @param f the f * @param data the data */ public static void add(@javax.annotation.Nonnull final DoubleSupplier f, @javax.annotation.Nonnull final double[] data) { for (int i = 0; i < data.length; i++) { data[i] += f.getAsDouble(); } }
From source file:com.gemstone.gemfire.internal.LocalStatisticsImplJUnitTest.java
@Test public void invokeDoubleSuppliersShouldUpdateStats() { DoubleSupplier supplier1 = mock(DoubleSupplier.class); when(supplier1.getAsDouble()).thenReturn(23.3); stats.setDoubleSupplier(4, supplier1); assertEquals(0, stats.invokeSuppliers()); verify(supplier1).getAsDouble();//from ww w . j a v a 2s .co m assertEquals(23.3, stats.getDouble(4), 0.1f); }
From source file:com.simiacryptus.mindseye.lang.Tensor.java
/** * Fill tensor./*from www . ja va 2 s . c o m*/ * * @param f the f * @return the tensor */ @Nonnull public Tensor set(@Nonnull final DoubleSupplier f) { Arrays.setAll(getData(), i -> f.getAsDouble()); return this; }
From source file:org.briljantframework.array.AbstractDoubleArray.java
@Override public void assign(DoubleSupplier supplier) { for (int i = 0; i < size(); i++) { set(i, supplier.getAsDouble()); }/*from w w w. jav a 2 s.c om*/ }