Generic pair class

后端 未结 14 1693
情话喂你
情话喂你 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:04

    Getters are broken

    public thing getFirst() {
      return thing.first;
    }
    
    public thing getSecond() {
      return thing.second;
    }
    

    thing should be replaced with this

提交回复
热议问题