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

标签 java javascript

我经常使用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/

相关文章:

java - 在 2D int 数组算法中收集重复值的索引

java - 如何获取从 fragment 到某个类的微调器项目位置?

java - 如何使用 nextLine() 解决 NoSuchElementException?

javascript - 为新用户创建网站介绍/展示的 jQuery/JS 插件

javascript - 限制文本区域中的单词

java - 正则表达式 : match any file under a certain directory, 除非叶目录被称为 "script"

javascript - bootstrap 折叠 div 上的 fitVids() - 在单个 iframe 上打开多个视频的小错误

javascript - 在 javascript 中使用正则表达式匹配并返回 [] 中包含的所有字符串

javascript - 使用 php 和 javascript 进行 AJAX 即时检查

java - Java 中未经检查的异常 : Inherit from Error or RuntimeException?