Object (final int row, final int column) { if(column == 0){ return myPairs.get(row).getFirst(); } else if(column == 1){ return myPairs.get(row).getSecond(); } else{ throw new IllegalArgumentException("unknown column: " + column); } }