Generic pair class

后端 未结 14 1679
情话喂你
情话喂你 2020-12-01 16:49

Just attempting this question I found in a past exam paper so that I can prepare for an upcoming Java examination.

Provide a generic class Pair for representing pair

14条回答
  •  一生所求
    2020-12-01 17:03

    You can look to implementation of standard Java classes AbstractMap.SimpleEntry and AbstractMap.SimpleImmutableEntry. It is pretty easy to google sources:

    • http://www.docjar.com/html/api/java/util/AbstractMap.java.html
    • http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/java/util/AbstractMap.java

提交回复
热议问题