A Java collection of value pairs? (tuples?)

后端 未结 19 2336
名媛妹妹
名媛妹妹 2020-11-22 05:43

I like how Java has a Map where you can define the types of each entry in the map, for example .

What I\'m looking for is a type

19条回答
  •  别那么骄傲
    2020-11-22 05:44

    You could write a generic Pair class and use this in an array or list. Yes, you have to write a class, but you can reuse the same class for all types, so you only have to do it once.

提交回复
热议问题