Java’s “pair” class was introduced in version 7 to create an easy way of returning two values from a method. You can certainly accomplish the same result by writing extra code, though using this existing class will be quicker and easier than implementing your own workaround.



©