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
You can look to implementation of standard Java classes AbstractMap.SimpleEntry and AbstractMap.SimpleImmutableEntry. It is pretty easy to google sources: