Example usage for java.util List replaceAll

List of usage examples for java.util List replaceAll

Introduction

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

Prototype

default void replaceAll(UnaryOperator<E> operator) 

Source Link

Document

Replaces each element of this list with the result of applying the operator to that element.

Usage

From source file:org.languagetool.rules.de.GermanSpellerRule.java

@Override
public List<String> getSuggestions(String word) throws IOException {
    List<String> suggestions = super.getSuggestions(word);
    suggestions = suggestions.stream()/* ww w .  j a  v  a  2 s .c  o m*/
            .filter(k -> !PREVENT_SUGGESTION.matcher(k).matches() && !k.endsWith("roulett"))
            .collect(Collectors.toList());
    if (word.endsWith(".")) {
        // To avoid losing the "." of "word" if it is at the end of a sentence.
        suggestions.replaceAll(s -> s.endsWith(".") ? s : s + ".");
    }
    suggestions = suggestions.stream().filter(k -> !k.equals(word)).collect(Collectors.toList());
    return suggestions;
}

From source file:org.openhab.tools.analysis.checkstyle.ManifestExternalLibrariesCheck.java

private List<String> getManifestJarFiles(FileText fileText) throws IOException {
    BundleInfo manifest = null;//from   w  ww .  jav  a  2s .c  o m
    try {
        manifest = parseManifestFromFile(fileText);
    } catch (CheckstyleException ex) {
        throw new IOException(COULD_NOT_OPEN_MANIFEST);
    }

    List<String> classpathEntries = manifest.getClasspath();
    if (classpathEntries != null) {
        // Spaces at the end of the bundle classpath are trimmed.
        classpathEntries.replaceAll(String::trim);

        // Binaries, compiled from the bundle sources are excluded. We will check only external binaries.
        classpathEntries.removeIf(x -> !x.contains(".jar"));
        return classpathEntries;
    } else {
        return Collections.emptyList();
    }
}