Example usage for java.util List removeAll

List of usage examples for java.util List removeAll

Introduction

In this page you can find the example usage for java.util List removeAll.

Prototype

boolean removeAll(Collection<?> c);

Source Link

Document

Removes from this list all of its elements that are contained in the specified collection (optional operation).

Usage

From source file:org.xwiki.contrib.repository.pypi.internal.searching.PypiPackageListIndexUpdateTask.java

private List<String> removePackagesIncludedInJython(List<String> packageNames) {
    packageNames.removeAll(PackagesInJython.getPackagesIncludedInJython().getPackages());
    return packageNames;
}

From source file:com.actian.services.knime.core.operators.DeriveGroupNodeDialogPane.java

@Override
public void refresh(PortMetadata[] specs) {
    this.inType = ((RecordMetadata) specs[0]).getType();

    List<String> inputFields = Arrays.asList(this.inType.getNames());
    List<String> currentKeyFields = new ArrayList<>();
    currentKeyFields.addAll(Arrays.asList(this.settings.keys.getStringArrayValue()));
    List<String> nonKeyFields = new ArrayList<>();
    nonKeyFields.addAll(inputFields);/*from w w  w  .  j  a va2  s . c o  m*/
    nonKeyFields.removeAll(currentKeyFields);

    currentKeyFields.retainAll(inputFields);
    this.columnSelect.setExcludeList(nonKeyFields);
    this.columnSelect.setIncludeList(currentKeyFields);
    this.expression.setText(this.settings.expression.getStringValue());
}

From source file:net.anthonychaves.bookmarks.service.BookmarkService.java

private List<String> diffTags(String originalTags, String newTags) {
    List<String> original = new ArrayList<String>(Arrays.asList(originalTags.split("\\W")));
    List<String> newT = new ArrayList<String>(Arrays.asList(newTags.split("\\W")));
    original.removeAll(newT);

    return original;
}

From source file:cd.go.contrib.elasticagents.dockerswarm.elasticagent.executors.MemoryMetadata.java

@Override
protected String doValidate(String input) {
    List<String> errors = new ArrayList<>(Arrays.asList(super.doValidate(input)));

    try {//from   w  w  w . j av a  2  s. com
        Size.parse(input);
    } catch (Exception e) {
        errors.add(e.getMessage());
    }

    errors.removeAll(Collections.singleton(null));

    if (errors.isEmpty()) {
        return null;
    }
    return StringUtils.join(errors, ". ");
}

From source file:cd.go.contrib.elasticagents.marathon.executors.MemoryMetadata.java

@Override
protected String doValidate(String input) {
    List<String> errors = new ArrayList<>();
    errors.add(super.doValidate(input));

    try {/*www  .  j  av  a2  s  .  com*/
        Size.parse(input);
    } catch (Exception e) {
        errors.add(e.getMessage());
    }

    errors.removeAll(Collections.singleton(null));

    if (errors.isEmpty()) {
        return null;
    }
    return StringUtils.join(errors, ". ");
}

From source file:com.hp.autonomy.frontend.find.hod.search.FindHodDocumentService.java

@Override
protected Documents<HodSearchResult> queryTextIndex(final SearchRequest<ResourceIdentifier> searchRequest,
        final boolean fetchPromotions) throws HodErrorException {
    try {/*from  w  w w .ja  va  2 s. c  om*/
        return super.queryTextIndex(searchRequest, fetchPromotions);
    } catch (final HodErrorException e) {
        if (e.getErrorCode() == HodErrorCode.INDEX_NAME_INVALID) {
            final Boolean publicIndexesEnabled = findConfigService.getConfig().getIod()
                    .getPublicIndexesEnabled();
            final HodDatabasesRequest databasesRequest = new HodDatabasesRequest.Builder()
                    .setPublicIndexesEnabled(publicIndexesEnabled).build();

            final Cache cache = cacheManager.getCache(CacheNames.DATABASES);
            if (cache != null) {
                cache.clear();
            }
            final Set<Database> updatedDatabases = databasesService.getDatabases(databasesRequest);

            final QueryRestrictions<ResourceIdentifier> queryRestrictions = searchRequest
                    .getQueryRestrictions();
            final Set<ResourceIdentifier> badIndexes = new HashSet<>(queryRestrictions.getDatabases());

            for (final Database database : updatedDatabases) {
                final ResourceIdentifier resourceIdentifier = new ResourceIdentifier(database.getDomain(),
                        database.getName());
                badIndexes.remove(resourceIdentifier);
            }

            final List<ResourceIdentifier> goodIndexes = new ArrayList<>(queryRestrictions.getDatabases());
            goodIndexes.removeAll(badIndexes);

            searchRequest.setQueryRestrictions(new HodQueryRestrictions.Builder()
                    .setQueryText(queryRestrictions.getQueryText())
                    .setFieldText(queryRestrictions.getFieldText()).setDatabases(goodIndexes)
                    .setMinDate(queryRestrictions.getMinDate()).setMaxDate(queryRestrictions.getMaxDate())
                    .setMinScore(queryRestrictions.getMinScore())
                    .setStateMatchId(queryRestrictions.getStateMatchId())
                    .setStateDontMatchId(queryRestrictions.getStateDontMatchId()).build());
            final Documents<HodSearchResult> resultDocuments = super.queryTextIndex(searchRequest,
                    fetchPromotions);
            final Warnings warnings = new Warnings(badIndexes);
            return new Documents<>(resultDocuments.getDocuments(), resultDocuments.getTotalResults(),
                    resultDocuments.getExpandedQuery(), resultDocuments.getSuggestion(),
                    resultDocuments.getAutoCorrection(), warnings);
        } else {
            throw e;
        }
    }
}

From source file:com.linksinnovation.elearning.controller.api.UserController.java

@RequestMapping(value = "/user/search/instructor", method = RequestMethod.POST)
public List<UserDetails> searchInstructor(@RequestBody Map<String, String> params) {
    Course course = courseRepositroy.findOne(Long.parseLong(params.get("course")));
    List<UserDetails> users = userDetailsRepository
            .findByNameEnIgnoreCaseLike("%" + params.get("search") + "%");
    users.removeAll(course.getInstructors());
    return users;
}

From source file:de.knoplab.todomaven.task.DefaultDataTask.java

@Override
public void deleteSelected() {
    List<TodoTask> listToDelete = this.todoTaskList;
    this.todoTaskList = this.todoTaskList.stream().filter(e -> e.getState() == false)
            .collect(Collectors.toList());
    listToDelete.removeAll(this.todoTaskList);
    listToDelete.forEach(e -> {//from  w ww .  ja  v a 2 s  .  com
        todoTaskList.remove(e);
        eventService.publish(new DataDeleteEvent(e));

    });
}

From source file:com.alibaba.otter.manager.web.home.module.screen.AddColumnPairGroup.java

public void execute(@Param("dataMediaPairId") Long dataMediaPairId, @Param("pipelineId") Long pipelineId,
        @Param("channelId") Long channelId, @Param("sourceMediaId") Long sourceMediaId,
        @Param("targetMediaId") Long targetMediaId, Context context) throws Exception {
    List<ColumnPair> columnPairs = dataColumnPairService.listByDataMediaPairId(dataMediaPairId);
    if (CollectionUtils.isEmpty(columnPairs)) {
        columnPairs.addAll(buildColumnPairFromDataMedia(dataMediaPairId, sourceMediaId, targetMediaId));
    } else {// w  w w.  ja v a  2 s  . c o  m
        DataMediaPair dataMediaPair = dataMediaPairService.findById(dataMediaPairId);
        if (dataMediaPair.getColumnPairMode().isExclude()) {
            List<ColumnPair> allColumnPairs = buildColumnPairFromDataMedia(dataMediaPairId, sourceMediaId,
                    targetMediaId);
            allColumnPairs.removeAll(columnPairs); // exclude?
            columnPairs = allColumnPairs;
        }
    }

    List<ColumnGroup> columnGroups = dataColumnPairGroupService.listByDataMediaPairId(dataMediaPairId);
    List<ColumnPair> columnPairGroup = new ArrayList<ColumnPair>();

    if (CollectionUtils.isNotEmpty(columnGroups)) {
        for (ColumnGroup columnGroup : columnGroups) {
            List<ColumnPair> columnPairTemp = new ArrayList<ColumnPair>();
            columnPairGroup = columnGroup.getColumnPairs();
            for (ColumnPair columnPair : columnPairGroup) {
                for (ColumnPair subColumnPair : columnPairs) {
                    if (columnPair.equals(subColumnPair)) {
                        columnPairTemp.add(subColumnPair);
                    }
                }
            }
            // Group??columnPair,?Group??
            columnPairs.removeAll(columnPairTemp);
        }
    }

    context.put("preColumnPairs", columnPairs); // groupcolumnPair
    context.put("columnPairs", columnPairGroup);// ?groupcolumnPair
    context.put("dataMediaPairId", dataMediaPairId);
    context.put("channelId", channelId);
    context.put("pipelineId", pipelineId);

}

From source file:io.ucoin.ucoinj.elasticsearch.Main.java

public void run(String[] args) {
    if (log.isInfoEnabled()) {
        log.info("Starting uCoinj :: ElasticSearch Indexer with arguments " + Arrays.toString(args));
    }/*  ww  w  .  java2s  .  c o m*/

    // By default, display help
    if (args == null || args.length == 0) {
        args = new String[] { "--help" };
    }

    List<String> arguments = Lists.newArrayList(Arrays.asList(args));
    arguments.removeAll(Arrays.asList(ConfigurationAction.HELP.aliases));

    // Could override config file name (useful for dev)
    String configFile = "ucoinj.config";
    if (System.getProperty(configFile) != null) {
        configFile = System.getProperty(configFile);
        configFile = configFile.replaceAll("\\\\", "/");
    }

    // Create configuration
    Configuration config = new Configuration(configFile, args) {
        protected void addAlias(ApplicationConfig applicationConfig) {
            super.addAlias(applicationConfig);
            // Add custom alias
        };
    };
    Configuration.setInstance(config);

    // Init i18n
    try {
        initI18n(config);
    } catch (IOException e) {
        throw new TechnicalException("i18n initialization failed", e);
    }

    // Add hook on system
    addShutdownHook();

    // Run all actions
    try {
        config.getApplicationConfig().doAllAction();
    } catch (Exception e) {
        log.error(e.getMessage(), e);
    }

    if (arguments.size() > 0) {

        // Check if auto-quit if need
        boolean quit = true;
        for (String startAlias : ConfigurationAction.START.aliases) {
            if (arguments.contains(startAlias)) {
                quit = false;
                break;
            }
        }

        // If scheduling is running, wait quit instruction
        if (!quit) {
            while (!quit) {
                String userInput = CommandLinesUtils.readInput(
                        "*** uCoinj :: Elasticsearch successfully started *** >> To quit, press [Q] or enter\n",
                        "Q", true);
                quit = StringUtils.isNotBlank(userInput) && "Q".equalsIgnoreCase(userInput);
            }
        }
    }

    // shutdown
    shutdown();

    log.info("uCoinj :: ElasticSearch Indexer successfully stopped");
    //System.exit(-1);
}