gpt4 book ai didi

java - 是否有用于 java 的 underscore.js 库?

转载 作者:塔克拉玛干 更新时间:2023-11-03 04:45:37 25 4
gpt4 key购买 nike

我经常使用javascript,找到 underscorejs 对于操作数据集非常方便,例如数组或对象。

我是 Java 的新手,想知道是否有类似的 Java 库?

最佳答案

有图书馆underscore-java . Live example

import com.github.underscore.U;

public class Main {
public static void main(String args[]) {
String[] words = {"Gallinule", "Escambio", "Aciform", "Entortilation", "Extensibility"};

Number sum = U.chain(words)
.filter(w -> w.startsWith("E"))
.map(w -> w.length())
.sum().item();
System.out.println("Sum of letters in words starting with E... " + sum);
}
}

// Sum of letters in words starting with E... 34

关于java - 是否有用于 java 的 underscore.js 库?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27772432/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com