I have code:
static void doSmth() {
ArrayList<String> list = new ArrayList<>();
for (int i = 0; i < 30; i++) {
list.add(String.valueOf(i));
}
list.stream().filter("1329"::contains).map(s -> s + "a").forEach(System.out::println);
}
Why i got:
1a
2a
3a
9a
13a
29a
I expected a empty output, because list doesn't contains "1329".
"1329"::containsis the issue. It expands tos -> "1329".contains(s)which is not what you want. Instead the behaviour you are looking for is"1329"::equals