I'm trying to make a filter with lambda. There is a list of string, which contains values, that should be sorted out and there's the other list, which contains different values (that's the one, that should be filtered). So what I've been trying to do is:
stringList = stringList.stream()
.filter(e ->toBeSortedOutList.forEach(outSorted->!e.startsWith(outSorted)))
.collect(Collectors.toList());
Unfortunately, I am allways getting the error, that boolean can't be converted to void. So what I wanted to know is, why that I am getting this error and if it's possible to filter by iterating trough a list and using its values for the filter? Thanks for your answers!
voidmethod, likeforEach, can be used as a predicate. I hope, you've already heard about that thing called API documentation