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:Main.java

public static void main(String[] args) {
    LongUnaryOperator i = (l) -> -l;

    System.out.println(i.applyAsLong(Long.MAX_VALUE));
}

From source file:Main.java

public static void main(String[] args) {
    LongUnaryOperator i = LongUnaryOperator.identity();

    System.out.println(i.applyAsLong(Long.MAX_VALUE));
}

From source file:at.gridtec.lambda4j.function.bi.obj.ObjLongToLongFunction.java

/**
 * Creates a {@link ObjLongToLongFunction} which uses the {@code second} parameter of this one as argument for the
 * given {@link LongUnaryOperator}.//from   ww  w .j a  va2  s  . c o m
 *
 * @param <T> The type of the first argument to the function
 * @param operator The operator which accepts the {@code second} parameter of this one
 * @return Creates a {@code ObjLongToLongFunction} which uses the {@code second} parameter of this one as argument
 * for the given {@code LongUnaryOperator}.
 * @throws NullPointerException If given argument is {@code null}
 */
@Nonnull
static <T> ObjLongToLongFunction<T> onlySecond(@Nonnull final LongUnaryOperator operator) {
    Objects.requireNonNull(operator);
    return (t, value) -> operator.applyAsLong(value);
}

From source file:at.gridtec.lambda4j.operator.binary.LongBinaryOperator2.java

/**
 * Creates a {@link LongBinaryOperator2} which uses the {@code first} parameter of this one as argument for the
 * given {@link LongUnaryOperator}./*from   w w  w .  j av  a  2  s  .c om*/
 *
 * @param operator The operator which accepts the {@code first} parameter of this one
 * @return Creates a {@code LongBinaryOperator2} which uses the {@code first} parameter of this one as argument for
 * the given {@code LongUnaryOperator}.
 * @throws NullPointerException If given argument is {@code null}
 */
@Nonnull
static LongBinaryOperator2 onlyFirst(@Nonnull final LongUnaryOperator operator) {
    Objects.requireNonNull(operator);
    return (value1, value2) -> operator.applyAsLong(value1);
}

From source file:at.gridtec.lambda4j.operator.binary.LongBinaryOperator2.java

/**
 * Creates a {@link LongBinaryOperator2} which uses the {@code second} parameter of this one as argument for the
 * given {@link LongUnaryOperator}.//from   ww w  . j  a  v a2 s .  co m
 *
 * @param operator The operator which accepts the {@code second} parameter of this one
 * @return Creates a {@code LongBinaryOperator2} which uses the {@code second} parameter of this one as argument for
 * the given {@code LongUnaryOperator}.
 * @throws NullPointerException If given argument is {@code null}
 */
@Nonnull
static LongBinaryOperator2 onlySecond(@Nonnull final LongUnaryOperator operator) {
    Objects.requireNonNull(operator);
    return (value1, value2) -> operator.applyAsLong(value2);
}

From source file:at.gridtec.lambda4j.operator.ternary.LongTernaryOperator.java

/**
 * Creates a {@link LongTernaryOperator} which uses the {@code first} parameter of this one as argument for the
 * given {@link LongUnaryOperator}./*from w  w  w .j av a2  s . c om*/
 *
 * @param operator The operator which accepts the {@code first} parameter of this one
 * @return Creates a {@code LongTernaryOperator} which uses the {@code first} parameter of this one as argument for
 * the given {@code LongUnaryOperator}.
 * @throws NullPointerException If given argument is {@code null}
 */
@Nonnull
static LongTernaryOperator onlyFirst(@Nonnull final LongUnaryOperator operator) {
    Objects.requireNonNull(operator);
    return (value1, value2, value3) -> operator.applyAsLong(value1);
}

From source file:at.gridtec.lambda4j.operator.ternary.LongTernaryOperator.java

/**
 * Creates a {@link LongTernaryOperator} which uses the {@code second} parameter of this one as argument for the
 * given {@link LongUnaryOperator}.// w  ww  . j a  v  a 2s  .  com
 *
 * @param operator The operator which accepts the {@code second} parameter of this one
 * @return Creates a {@code LongTernaryOperator} which uses the {@code second} parameter of this one as argument for
 * the given {@code LongUnaryOperator}.
 * @throws NullPointerException If given argument is {@code null}
 */
@Nonnull
static LongTernaryOperator onlySecond(@Nonnull final LongUnaryOperator operator) {
    Objects.requireNonNull(operator);
    return (value1, value2, value3) -> operator.applyAsLong(value2);
}

From source file:at.gridtec.lambda4j.operator.ternary.LongTernaryOperator.java

/**
 * Creates a {@link LongTernaryOperator} which uses the {@code third} parameter of this one as argument for the
 * given {@link LongUnaryOperator}./*from   w  w w . ja  v a  2s .  c  o  m*/
 *
 * @param operator The operator which accepts the {@code third} parameter of this one
 * @return Creates a {@code LongTernaryOperator} which uses the {@code third} parameter of this one as argument for
 * the given {@code LongUnaryOperator}.
 * @throws NullPointerException If given argument is {@code null}
 */
@Nonnull
static LongTernaryOperator onlyThird(@Nonnull final LongUnaryOperator operator) {
    Objects.requireNonNull(operator);
    return (value1, value2, value3) -> operator.applyAsLong(value3);
}

From source file:at.gridtec.lambda4j.function.tri.obj.ObjBiLongToLongFunction.java

/**
 * Creates a {@link ObjBiLongToLongFunction} which uses the {@code second} parameter of this one as argument for the
 * given {@link LongUnaryOperator}.//from  ww  w.j a  va 2 s .c o m
 *
 * @param <T> The type of the first argument to the function
 * @param operator The operator which accepts the {@code second} parameter of this one
 * @return Creates a {@code ObjBiLongToLongFunction} which uses the {@code second} parameter of this one as argument
 * for the given {@code LongUnaryOperator}.
 * @throws NullPointerException If given argument is {@code null}
 */
@Nonnull
static <T> ObjBiLongToLongFunction<T> onlySecond(@Nonnull final LongUnaryOperator operator) {
    Objects.requireNonNull(operator);
    return (t, value1, value2) -> operator.applyAsLong(value1);
}

From source file:at.gridtec.lambda4j.function.tri.obj.ObjBiLongToLongFunction.java

/**
 * Creates a {@link ObjBiLongToLongFunction} which uses the {@code third} parameter of this one as argument for the
 * given {@link LongUnaryOperator}./*from w w w  .j a va2  s.  c  o  m*/
 *
 * @param <T> The type of the first argument to the function
 * @param operator The operator which accepts the {@code third} parameter of this one
 * @return Creates a {@code ObjBiLongToLongFunction} which uses the {@code third} parameter of this one as argument
 * for the given {@code LongUnaryOperator}.
 * @throws NullPointerException If given argument is {@code null}
 */
@Nonnull
static <T> ObjBiLongToLongFunction<T> onlyThird(@Nonnull final LongUnaryOperator operator) {
    Objects.requireNonNull(operator);
    return (t, value1, value2) -> operator.applyAsLong(value2);
}