Couple<List<Integer>> (String keyCodesText) { List<Integer> codes = new ArrayList<>(); List<Integer> modifiers = new ArrayList<>(); if (keyCodesText != null) { String[] pairs = keyCodesText.split(CODE_DELIMITER); for (String each : pairs) { String[] strings = each.split(MODIFIER_DELIMITER); if (strings.length == 2) { codes.add(Integer.valueOf(strings[0])); modifiers.add(Integer.valueOf(strings[1])); } } } return Couple.of(codes, modifiers); }