S
Size: a a a
S
S
В
В
N🌌
N🌌
L
N🌌
N🌌
L
L
T
L
GV
Arrays.stream(test.split("\\s+"))
.filter(s -> s.equals(word))
.count();
Arrays.stream(test.split("\\s+"))
.collect(Collectors.groupingBy(e -> e, Collectors.counting()));
Benchmark Mode Cnt Score Error Units
Benchmark.plainStreamWithArray avgt 9 10,424 ± 2,444 ms/op
Benchmark.streamToMap avgt 9 48,828 ± 9,693 ms/op
GV
T
GV
for (int i = 0; i < 100000; i++) {
stringBuilder.append(i);
stringBuilder.append(" ");
test = stringBuilder.toString();
}
GV
Benchmark Mode Cnt Score Error Units
Benchmark.patternToStream avgt 9 1,255 ± 0,404 ms/op
Benchmark.plainStreamWithArray avgt 9 10,270 ± 2,513 ms/op
Benchmark.streamToMap avgt 9 47,813 ± 4,097 ms/op