Hank Gay Hank Gay - 1 year ago 121
Java Question

Is there an accepted Java equivalent to Python's zip()?

I've got two

objects and I want to pair them up, just like the
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.

Answer Source

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.)

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download