这个 IntToLongFunction接口 是这个世界的一部分 JAVAutil。作用 从Java 8开始引入的包,用于实现 函数式编程 在爪哇。它表示一个函数,该函数接受一个int值参数并给出一个长值结果。
null
INTONGDA用于定义表达式的函数类型 applyAsLong() 最终对其唯一参数应用给定的操作。这类似于使用Function
IntToLongFunction接口只有一个功能:
applyAsLong(): 此方法接受一个int值参数,并给出一个长值结果。
语法:
long applyAsLong(int value)
参数: 这个方法只接受一个参数 价值 这就是整型参数。
返回: 此方法返回一个 长期价值 后果
下面是说明applyAsLong()方法的代码:
程序
// Java Program to demonstrate // IntToLongFunction's applyAsLong() method import java.util.function.IntToLongFunction; public class Main { public static void main(String args[]) { // Declare the IntToLongFunction IntToLongFunction func = a -> 1000000 * a; // Apply the function to get the result as long // using applyAsLong() System.out.println(func.applyAsLong( 2 )); } } |
输出:
2000000
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END