是否存在与 Python 的 zip() 等效的公认 Java? [英] Is there an accepted Java equivalent to Python's zip()?

查看:23
本文介绍了是否存在与 Python 的 zip() 等效的公认 Java?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个 List 对象,我想将它们配对,就像 zip() Python 中的函数.我很确定这在 JDK 中不可用,但是在相当广泛的库中是否有类似的东西,类似于 Apache Commons 集合?谢谢.

I've got two List objects and I want to pair them up, just like the zip() function in Python. I'm pretty sure this isn't available in the JDK, but is there something like this in a fairly widespread library, similar to Apache Commons Collections? Thanks.

推荐答案

Functional Javazip, zipWithzipIndex 与您对 Haskell 或 Scala 的期望相同.(实际上,作者几乎都是 Haskell 程序员.)

Functional Java has zip, zipWith and zipIndex the way you would expect from Haskell or Scala. (Indeed, the authors are pretty much all Haskell programmers.)

这篇关于是否存在与 Python 的 zip() 等效的公认 Java?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆