harp1814 :
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".
YCF_L :
because
.filter("1329"::contains)
mean
.filter(s -> "1329".contains(s))
not
.filter(s -> s.contains("1329"))
As I guess you think it means.
So your list hold :
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, ... 25, 26, 27, 28, 29]
^ ^ ^ ^ ^ ^
Which "1329"
contains 1,2, 3, 9, 13 and 29