ExpressionUtils { public static Map<String, Set<Object>> mergeFixedValueConditions(Map<String, Set<Object>> left, Map<String, Set<Object>> right) { right.keySet().forEach(columnName -> { Set<Object> newValues = right.get(columnName); if (newValues != null) { left.merge(columnName, newValues, (l, r) -> new HashSet<Object>(){ { addAll(l); addAll(r); } }); } }); return left; }  static boolean isConstant(Class<?> expressionClass); static boolean isConstant(Object expression); static boolean isString(Class<?> expressionClass); static boolean isInteger(Class<?> expressionClass); static boolean isDouble(Class<?> expressionClass); static boolean isNumber(Class<?> expressionClass); static boolean isBoolean(Class<?> expressionClass); static boolean isDate(Class<?> expressionClass); static boolean isColumnExpression(Object expression); static boolean oneOfIsNull(Object left, Object right); static boolean bothAreNumbers(Class<?> leftClass, Class<?> rightClass); static boolean bothAreIntegers(Class<?> leftClass, Class<?> rightClass); static boolean bothAreStrings(Class<?> leftClass, Class<?> rightClass); static boolean bothAreBooleans(Class<?> leftClass, Class<?> rightClass); static int asInt(Object value); static double asDouble(Object value); static String asString(Object value); static Boolean asBoolean(Object value); static ColumnExpression asColumnExpression(Object value); static List<String> columnsToNames(Collection<Column> columns); static Map<String, List<String>> columnsToMap(String tableAlias, Collection<Column> columns); static Optional<BooleanExpression> columnsToCondition(Optional<BooleanExpression> joinCondition, String leftTableAlias, List<String> columnNames, String rightTableAlias); static Map<String, Set<Object>> mergeFixedValueConditions(Map<String, Set<Object>> left, Map<String, Set<Object>> right);  }
@Test public void mergeFixedValueConditions() throws Exception { Map<String, Set<Object>> left = new HashMap<String, Set<Object>>(){ { put("first", Collections.singleton("one")); } }; Map<String, Set<Object>> right = new HashMap<String, Set<Object>>(){ { put("first", Collections.singleton("two")); put("second", Collections.singleton("three")); } }; Map<String, Set<Object>> result = ExpressionUtils.mergeFixedValueConditions(left, right); assertThat(result, equalTo(new HashMap<String, Set<Object>>(){ { put("first", new HashSet<>(Arrays.asList("one", "two"))); put("second", Collections.singleton("three")); } })); }