Java: How to write a `zip` function? What should be the return type?

后端 未结 5 1446
攒了一身酷
攒了一身酷 2020-12-06 02:48

What should be the return type of a zip function? (zip as in most other languages, e.g. read here)

I thought about some Pair-type but that

5条回答
  •  不思量自难忘°
    2020-12-06 03:23

    No, there isn't explicitly a pair (or any tuple) in the standard JRE.

    There was a discussion on the subject on the javaposse Google group that you might be interested in, that links off to a post by Dick Wall on why Java needs a Pair and a Triple, plus a similar question asked here.


    Update - original question was whether there was a Pair in Java. This answer may no longer make sense.

提交回复
热议问题