本文介绍了Java中的函数式编程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否有一个用于Java函数式编程的良好库?
我正在寻找诸如和(作为一个静态方法)。
解决方案
是最知名的图书馆;它使用Java关闭()举例:
final Array< Integer> a =数组(1,2,3);
final Array< Integer> b = a.map({int i => i + 42});
arrayShow(intShow).println(b); // {43,44,45}
编辑
请检查。
进一步编辑
BGGA完全是可选的。它只是为了更好的语法。
Is there a good library for functional programming in Java?
I'm looking for stuff like Predicate and List.Find() (as a static method). Not complicated to implement, but it would be nice to find a reusable library here.
解决方案
FunctionalJava is the best known library; it makes use of Java closures (BGGA) for examples:
final Array<Integer> a = array(1, 2, 3);
final Array<Integer> b = a.map({int i => i + 42});
arrayShow(intShow).println(b); // {43,44,45}
EDIT
Check also lambdaj.
Further EDIT
BGGA is entirely optional. It just makes for nicer syntax.
这篇关于Java中的函数式编程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!