Search in sources :

Example 11 with LongStream

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

the class GenerateTest method testStreamGenerate.

@Test
public void testStreamGenerate() {
    LongStream stream = LongStream.generate(new LongSupplier() {

        @Override
        public long getAsLong() {
            return 1234L;
        }
    });
    assertThat(stream.limit(3), elements(arrayContaining(1234L, 1234L, 1234L)));
}
Also used : LongStream(com.annimon.stream.LongStream) LongSupplier(com.annimon.stream.function.LongSupplier) Test(org.junit.Test)

Aggregations

LongStream (com.annimon.stream.LongStream)11 Test (org.junit.Test)9 CustomOperators (com.annimon.stream.CustomOperators)1 Function (com.annimon.stream.function.Function)1 LongBinaryOperator (com.annimon.stream.function.LongBinaryOperator)1 LongPredicate (com.annimon.stream.function.LongPredicate)1 LongSupplier (com.annimon.stream.function.LongSupplier)1 PrimitiveIterator (com.annimon.stream.iterator.PrimitiveIterator)1