private Map<String, List<Condition>> sortConditionsByType(List<Condition> conditions) { Map<String, List<Condition>> conditionsByType = new HashMap<String, List<Condition>>(); for (Condition condition : conditions) { String conditionType = condition.getType(); if (conditionsByType.get(conditionType) == null) { conditionsByType.put(conditionType, new ArrayList<Condition>()); } conditionsByType.get(conditionType).add(condition); } return conditionsByType; }
private Map<String, List<String>> sortConditionsByKey(List<Condition> conditions) { Map<String, List<String>> conditionValuesByConditionKey = new HashMap<String, List<String>>(); for (Condition condition : conditions) { String key = condition.getConditionKey(); List<String> values = condition.getValues(); if (conditionValuesByConditionKey.containsKey(key) == false) { conditionValuesByConditionKey.put(key, new ArrayList<String>()); } conditionValuesByConditionKey.get(key).addAll(values); } return conditionValuesByConditionKey; }