Example usage for java.util.function LongUnaryOperator applyAsLong

List of usage examples for java.util.function LongUnaryOperator applyAsLong

Introduction

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

Prototype

long applyAsLong(long operand);

Source Link

Document

Applies this operator to the given operand.

Usage

From source file:org.briljantframework.array.AbstractLongArray.java

@Override
public LongArray map(LongUnaryOperator operator) {
    LongArray mat = newEmptyArray(getShape());
    for (int i = 0; i < size(); i++) {
        mat.set(i, operator.applyAsLong(get(i)));
    }/* w  ww  .  j a  v  a  2 s . c o  m*/
    return mat;
}

From source file:org.briljantframework.array.AbstractLongArray.java

@Override
public void apply(LongUnaryOperator operator) {
    for (int i = 0; i < size(); i++) {
        set(i, operator.applyAsLong(get(i)));
    }//from  w ww.  j  av a2s . co m
}

From source file:org.briljantframework.array.AbstractLongArray.java

@Override
public long reduce(long identity, LongBinaryOperator reduce, LongUnaryOperator map) {
    for (int i = 0; i < size(); i++) {
        identity = reduce.applyAsLong(map.applyAsLong(get(i)), identity);
    }/*from  w  w  w  . j ava2s.c  o  m*/
    return identity;
}