Search in sources :

Example 1 with DoubleSupplier

use of com.annimon.stream.function.DoubleSupplier in project Lightweight-Stream-API by aNNiMON.

the class GenerateTest method testStreamGenerate.

@Test
public void testStreamGenerate() {
    DoubleStream stream = DoubleStream.generate(new DoubleSupplier() {

        @Override
        public double getAsDouble() {
            return 1.234;
        }
    });
    assertThat(stream.limit(3), elements(arrayContaining(1.234, 1.234, 1.234)));
}
Also used : DoubleSupplier(com.annimon.stream.function.DoubleSupplier) DoubleStream(com.annimon.stream.DoubleStream) Test(org.junit.Test)

Aggregations

DoubleStream (com.annimon.stream.DoubleStream)1 DoubleSupplier (com.annimon.stream.function.DoubleSupplier)1 Test (org.junit.Test)1