import java.util.function.Predicate; import java.nio.file.Path; import java.nio.file.Files; public class Filter { private Predicate predicate; private Path filePath; public Filter(Predicate predicate, Path filePath) { this.predicate = predicate; this.filePath = filePath; } /** * Puts all lines for which the predicate evaluates to true * to stdout */ public void process() { } /** * Puts all lines for which the predicate evaluates to true * to the path specified by dest * @return true if file is written to successfully * and false if it fails. */ public boolean process(Path dest) { return false; } public static void main(String[] args) { Path p = Path.of("file"); Filter f = new Filter(p, (String x) -> x.length() > 10); f.process(); } }