Java SE API
IntUnaryOperator.applyAsInt()
Invokes a primitive int transformation without boxing at the functional boundary.
Formal Syntax & Structure
java syntaxjava
int applyAsInt(int operand)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| operand | int | Input integer |
Return Value
int
Result integer
Working Example
Example Snippetjava
import java.util.*;import java.util.function.*;public class Main {
public static void main(String[] args) { IntUnaryOperator addFee = cents -> cents + 25; UnaryOperator<String> prefix = s -> "#" + s; BinaryOperator<Integer> chooseLarger = (a, b) -> Math.max(a, b); System.out.println(addFee.applyAsInt(100)); System.out.println(prefix.apply("A7")); System.out.println(chooseLarger.apply(3, 8)); }}