diff options
| author | Roy van Rijn <roy.van.rijn@gmail.com> | 2024-01-01 18:33:40 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-01-01 18:33:40 +0100 |
| commit | 2155286d7a02ee3b92596d8905607277a0bcfbe7 (patch) | |
| tree | 6b8b68642f603a1a20f52b584810fb30e3f3cbc1 /src/main/java/dev/morling/onebrc/CalculateAverage.java | |
| parent | 647d0c578ecffe2880ab50195e747d87f0259557 (diff) | |
Initial implementation, using BufferedReader, parallel processing, combining everything in a single go, sorting afterwards (unoptimized)
Diffstat (limited to 'src/main/java/dev/morling/onebrc/CalculateAverage.java')
| -rw-r--r-- | src/main/java/dev/morling/onebrc/CalculateAverage.java | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/main/java/dev/morling/onebrc/CalculateAverage.java b/src/main/java/dev/morling/onebrc/CalculateAverage.java index c1b8258..b2f4e59 100644 --- a/src/main/java/dev/morling/onebrc/CalculateAverage.java +++ b/src/main/java/dev/morling/onebrc/CalculateAverage.java @@ -52,14 +52,14 @@ public class CalculateAverage { } public static void main(String[] args) throws IOException { -// Map<String, Double> measurements1 = Files.lines(Paths.get(FILE)) -// .map(l -> l.split(";")) -// .collect(groupingBy(m -> m[0], averagingDouble(m -> Double.parseDouble(m[1])))); -// -// measurements1 = new TreeMap<>(measurements1.entrySet() -// .stream() -// .collect(toMap(e -> e.getKey(), e -> Math.round(e.getValue() * 10.0) / 10.0))); -// System.out.println(measurements1); + // Map<String, Double> measurements1 = Files.lines(Paths.get(FILE)) + // .map(l -> l.split(";")) + // .collect(groupingBy(m -> m[0], averagingDouble(m -> Double.parseDouble(m[1])))); + // + // measurements1 = new TreeMap<>(measurements1.entrySet() + // .stream() + // .collect(toMap(e -> e.getKey(), e -> Math.round(e.getValue() * 10.0) / 10.0))); + // System.out.println(measurements1); Collector<Measurement, MeasurementAggregator, ResultRow> collector = Collector.of( MeasurementAggregator::new, |
