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

前端 未结 30 1478
一个人的身影
一个人的身影 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

    Good News JavaFX has a key value Pair.

    just add javafx as a dependency and import javafx.util.Pair;

    and use simply as in c++ .

    Pair  
    

    e.g.

    Pair  pr = new Pair()
    
    pr.get(key);// will return corresponding value
    

提交回复
热议问题