Example usage for java.util Collection removeIf

List of usage examples for java.util Collection removeIf

Introduction

In this page you can find the example usage for java.util Collection removeIf.

Prototype

default boolean removeIf(Predicate<? super E> filter) 

Source Link

Document

Removes all of the elements of this collection that satisfy the given predicate.

Usage

From source file:org.sonarsource.scanner.maven.bootstrap.MavenProjectConverter.java

private static void removeTarget(MavenProject pom, Collection<String> relativeOrAbsolutePaths) {
    final Path baseDir = pom.getBasedir().toPath().toAbsolutePath().normalize();
    final Path target = Paths.get(pom.getBuild().getDirectory()).toAbsolutePath().normalize();
    final Path targetRelativePath = baseDir.relativize(target);

    relativeOrAbsolutePaths.removeIf(pathStr -> {
        Path path = Paths.get(pathStr).toAbsolutePath().normalize();
        Path relativePath = baseDir.relativize(path);
        return relativePath.startsWith(targetRelativePath);
    });/*  w w w.  java2s  . c  o  m*/
}