Cleanup Stream usage in various spots (#97306)

Lots of spots where we did weird things around streams like redundant stream creation, redundant collecting
before adding all the collected elements to another collection or so, redundant streams for joining strings
and using less efficient `Collectors.toList` and in a few cases also incorrectly relying on the result being mutable.
This commit is contained in:
Armin Braun 2023-07-03 14:24:57 +02:00 committed by GitHub
parent 5eeaecd9cf
commit 63e64ae61b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
117 changed files with 321 additions and 442 deletions

View file

@ -18,7 +18,6 @@ import java.lang.management.GarbageCollectorMXBean;
import java.lang.management.ManagementFactory;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
public abstract class AbstractBenchmark<T extends Closeable> {
private static final int SEARCH_BENCHMARK_ITERATIONS = 10_000;
@ -92,7 +91,7 @@ public abstract class AbstractBenchmark<T extends Closeable> {
String benchmarkTargetHost = args[1];
String indexName = args[2];
String searchBody = args[3];
List<Integer> throughputRates = Arrays.asList(args[4].split(",")).stream().map(Integer::valueOf).collect(Collectors.toList());
List<Integer> throughputRates = Arrays.stream(args[4].split(",")).map(Integer::valueOf).toList();
T client = client(benchmarkTargetHost);