/** * Returns the sum of the given lists. This is their intersection * subtracted from their union. * * @param list1 the first list * @param list2 the second list * @return a new list containing the sum of those lists * @throws NullPointerException if either list is null */ public static List sum(final List list1, final List list2) { return subtract(union(list1, list2), intersection(list1, list2)); }
/** * Returns the sum of the given lists. This is their intersection * subtracted from their union. * * @param list1 the first list * @param list2 the second list * @return a new list containing the sum of those lists * @throws NullPointerException if either list is null */ public static List sum(final List list1, final List list2) { return subtract(union(list1, list2), intersection(list1, list2)); }
private List<?> mergeDeltaContent(List<?> giveValues, List<?> foundValues) { return ListUtils.subtract(giveValues, foundValues); }
/** * Subtracts all elements in the second list from the first list, * placing the results in a new list. * <p> * This differs from {@link List#removeAll(Collection)} in that * cardinality is respected; if <Code>list1</Code> contains two * occurrences of <Code>null</Code> and <Code>list2</Code> only * contains one occurrence, then the returned list will still contain * one occurrence. * * @param list1 the list to subtract from * @param list2 the list to subtract * @return a new list containing the results * @throws NullPointerException if either list is null */ @SuppressWarnings("unchecked") public static <T> List<T> subtract(final List<T> list1, final List<T> list2) { return org.apache.commons.collections.ListUtils.subtract(list1, list2); }
private List<?> mergeTargetContent(List<?> giveValues, List<?> foundValues, AtomicBoolean hasChange) { List<?> result = null; if (pull) { result = ListUtils.subtract(foundValues, giveValues); } else { result = ListUtils.sum(foundValues, giveValues); } hasChange.set(!ListUtils.isEqualList(result, foundValues)); return result; } }
List<FormField> childFormFields = ListUtils.subtract(updatedFormFields, originalFormFields);
/** * The main execution method which will be called upon event arrival. * when there are more than one function parameter * This method calculates subtraction of two List Of Strings * Each String is a jobs string needs to be loaded * @param data the runtime values of function parameters * @return the function result */ @Override protected Object execute(Object[] data) { try { List<String> ths = JsonUtils.jsonStringToList((String) data[0]); List<String> rhs = JsonUtils.jsonStringToList((String) data[1]); return org.apache.commons.lang.StringUtils.join(ListUtils.subtract(ths, rhs), "\n"); } catch (Exception e) { LOG.warn("exception found {}", e); return null; } }
/** * Returns the sum of the given lists. This is their intersection * subtracted from their union. * * @param list1 the first list * @param list2 the second list * @return a new list containing the sum of those lists * @throws NullPointerException if either list is null */ public static List sum(final List list1, final List list2) { return subtract(union(list1, list2), intersection(list1, list2)); }
/** * Returns the sum of the given lists. This is their intersection * subtracted from their union. * * @param list1 the first list * @param list2 the second list * @return a new list containing the sum of those lists * @throws NullPointerException if either list is null */ public static List sum(final List list1, final List list2) { return subtract(union(list1, list2), intersection(list1, list2)); }
/** * Returns the sum of the given lists. This is their intersection * subtracted from their union. * * @param list1 the first list * @param list2 the second list * @return a new list containing the sum of those lists * @throws NullPointerException if either list is null */ public static List sum(final List list1, final List list2) { return subtract(union(list1, list2), intersection(list1, list2)); }
/** * Returns the sum of the given lists. This is their intersection * subtracted from their union. * * @param list1 the first list * @param list2 the second list * @return a new list containing the sum of those lists * @throws NullPointerException if either list is null */ public static List sum(final List list1, final List list2) { return subtract(union(list1, list2), intersection(list1, list2)); }
/** * Returns the sum of the given lists. This is their intersection * subtracted from their union. * * @param list1 the first list * @param list2 the second list * @return a new list containing the sum of those lists * @throws NullPointerException if either list is null */ public static List sum(final List list1, final List list2) { return subtract(union(list1, list2), intersection(list1, list2)); }
@SuppressWarnings("unchecked") private CandidateSeed doMutation(CandidateSeed seed) { List<Integer> geneList = new ArrayList<Integer>(); List<Integer> unselectedGeneList = ListUtils.subtract(variables, seed.getColumnIdList()); Collections.shuffle(unselectedGeneList); int replaceCnt = 0; for ( int i = 0; i < seed.getColumnIdList().size(); i ++ ) { if ( rd.nextDouble() < 0.05 ) { replaceCnt ++; } else { geneList.add(seed.getColumnIdList().get(i)); } } if ( replaceCnt > 0 ) { geneList.addAll(unselectedGeneList.subList(0, replaceCnt)); } return new CandidateSeed(this.genSeedId(), geneList); }
@SuppressWarnings("unchecked") public static <T> List<T> subtract(ActionContext actionContext){ Thing self = actionContext.getObject("self"); List<T> list1 = (List<T>) self.doAction("getList1", actionContext); List<T> list2 = (List<T>) self.doAction("getList2", actionContext); return ListUtils.subtract(list1, list2); }
@SuppressWarnings("unchecked") public Diff compare(Features before) { String errorMessage = format("Can't compare: scenarios size changed from %s to %s", before.scenarios.size(), this.scenarios.size()); checkState(this.scenarios.size() == before.scenarios.size(), errorMessage); List<Scenario> newlyPassingScenarios = subtract(this.passingScenarios, before.passingScenarios); List<Scenario> newlyFailedScenarios = subtract(this.failedScenarios, before.failedScenarios); int totalPassingScenarios = passingScenarios.size(); int totalScenarios = scenarios.size(); return new Diff(newlyPassingScenarios, newlyFailedScenarios, totalPassingScenarios, totalScenarios, scenarios); }
List<Integer> candidatePolicyGroupIdsToBeDeleted = ListUtils.subtract(policyGroupIdsForApp, retainedPolicyGroupIds);
/** * Check to make sure that the fields of the inputs are the same as the output field names. * If not, insert a project renaming them. */ public RelNode getLateralInput(int ordinal, RelNode input) { int offset = ordinal == 0 ? 0 : getInputSize(0); Preconditions.checkArgument(DrillJoinRelBase.uniqueFieldNames(input.getRowType())); final List<String> fields = getRowType().getFieldNames(); final List<String> inputFields = input.getRowType().getFieldNames(); final List<String> outputFields = fields.subList(offset, offset + getInputSize(ordinal)); if (ListUtils.subtract(outputFields, inputFields).size() != 0) { // Ensure that input field names are the same as output field names. // If there are duplicate field names on left and right, fields will get // lost. // In such case, we need insert a rename Project on top of the input. return rename(input, input.getRowType().getFieldList(), outputFields); } else { return input; } }