/** * Removes the elements in <code>remove</code> from <code>collection</code>. That is, this * method returns a collection containing all the elements in <code>c</code> * that are not in <code>remove</code>. The cardinality of an element <code>e</code> * in the returned collection is the same as the cardinality of <code>e</code> * in <code>collection</code> unless <code>remove</code> contains <code>e</code>, in which * case the cardinality is zero. This method is useful if you do not wish to modify * the collection <code>c</code> and thus cannot call <code>collection.removeAll(remove);</code>. * <p> * This implementation iterates over <code>collection</code>, checking each element in * turn to see if it's contained in <code>remove</code>. If it's not contained, it's added * to the returned list. As a consequence, it is advised to use a collection type for * <code>remove</code> that provides a fast (e.g. O(1)) implementation of * {@link Collection#contains(Object)}. * * @param <E> the type of object the {@link Collection} contains * @param collection the collection from which items are removed (in the returned collection) * @param remove the items to be removed from the returned <code>collection</code> * @return a <code>Collection</code> containing all the elements of <code>collection</code> except * any elements that also occur in <code>remove</code>. * @throws NullPointerException if either parameter is null * @since 4.0 (method existed in 3.2 but was completely broken) */ public static <E> Collection<E> removeAll(final Collection<E> collection, final Collection<?> remove) { return ListUtils.removeAll(collection, remove); }
private List<PartialConfig> removePartialsThatDoNotCorrespondToTheCurrentConfigReposList(List<PartialConfig> partList) { List<Object> notToBeMerged = new ArrayList<>(); for (PartialConfig partialConfig : partList) { if (partialConfig.getOrigin() instanceof RepoConfigOrigin) { RepoConfigOrigin origin = (RepoConfigOrigin) partialConfig.getOrigin(); if (!configRepos.hasMaterialWithFingerprint(origin.getMaterial().getFingerprint())) notToBeMerged.add(partialConfig); } } partList = ListUtils.removeAll(partList, notToBeMerged); return partList; }
/** * @param activeSuites the suite names that are active * @param parallelSuites the suite names to be executed in parallel * @param sequentialSuites the suite names to be executed in sequential manner * @return */ private static List<String> getDefaultRunModeTestSuites(final List<String> activeSuites, final List<String> parallelSuites, final List<String> sequentialSuites) { return removeAll(new ArrayList<>(activeSuites), union(parallelSuites, sequentialSuites)); }
private boolean shouldUpdateTags(CloudServiceExtended service, List<String> defaultTags, List<String> existingServiceTags) { if (service.isUserProvided()) { return false; } existingServiceTags = ObjectUtils.defaultIfNull(existingServiceTags, Collections.emptyList()); existingServiceTags = ListUtils.removeAll(existingServiceTags, defaultTags); List<String> newServiceTags = ListUtils.removeAll(service.getTags(), defaultTags); return !existingServiceTags.equals(newServiceTags); }
List<Long> lastIds = ListUtils.removeAll(ids, redisIds); if (CollectionUtils.isNotEmpty(lastIds)) { List<UserDO> dbList = list(lastIds);
public static List<String> differenceInSubmissionFields(Collection fromCollection, Collection toCollection) throws DCInputsReaderException { DCInputsReader reader = new DCInputsReader(); List<DCInputSet> from = reader.getInputsByCollectionHandle(fromCollection.getHandle()); List<DCInputSet> to = reader.getInputsByCollectionHandle(toCollection.getHandle()); Set<String> fromFieldName = new HashSet<>(); Set<String> toFieldName = new HashSet<>(); for (DCInputSet ff : from) { for (DCInput[] fdcrow : ff.getFields()) { for (DCInput fdc : fdcrow) { fromFieldName.add(fdc.getFieldName()); } } } for (DCInputSet tt : to) { for (DCInput[] tdcrow : tt.getFields()) { for (DCInput tdc : tdcrow) { toFieldName.add(tdc.getFieldName()); } } } return ListUtils.removeAll(fromFieldName, toFieldName); } }