Search in sources :

Example 1 with LongUnaryOperator

use of java8.util.function.LongUnaryOperator in project streamsupport by stefan-zobel.

the class LongPrimitiveOpsTests method testMap.

public void testMap() {
    long sum = LongStreams.range(1, 10).filter(new LongPredicate() {

        @Override
        public boolean test(long i) {
            return i % 2 == 0;
        }
    }).map(new LongUnaryOperator() {

        @Override
        public long applyAsLong(long i) {
            return i * 2;
        }
    }).sum();
    assertEquals(sum, 40);
}
Also used : LongUnaryOperator(java8.util.function.LongUnaryOperator) LongPredicate(java8.util.function.LongPredicate)

Aggregations

LongPredicate (java8.util.function.LongPredicate)1 LongUnaryOperator (java8.util.function.LongUnaryOperator)1