What is the equivalent of the C++ Pair in Java?

前端 未结 30 1507
一个人的身影
一个人的身影 2020-11-22 02:29

Is there a good reason why there is no Pair in Java? What would be the equivalent of this C++ construct? I would rather avoid reimplementing my own.<

30条回答
  •  暗喜
    暗喜 (楼主)
    2020-11-22 03:01

    Pair would be a good stuff, to be a basic construction unit for a complex generics, for instance, this is from my code:

    WeakHashMap, String> map = ...
    

    It is just the same as Haskell's Tuple

提交回复
热议问题