[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [collector/master] Replace lambdas with method references.



commit e88a10371160477a29fa3098af857f7fd2c731ac
Author: Karsten Loesing <karsten.loesing@xxxxxxx>
Date:   Mon Aug 20 15:18:16 2018 +0200

    Replace lambdas with method references.
---
 .../torproject/metrics/collector/bridgedescs/DescriptorBuilder.java | 2 +-
 .../org/torproject/metrics/collector/webstats/SanitizeWeblogs.java  | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/main/java/org/torproject/metrics/collector/bridgedescs/DescriptorBuilder.java b/src/main/java/org/torproject/metrics/collector/bridgedescs/DescriptorBuilder.java
index 367e2e2..8fc25b4 100644
--- a/src/main/java/org/torproject/metrics/collector/bridgedescs/DescriptorBuilder.java
+++ b/src/main/java/org/torproject/metrics/collector/bridgedescs/DescriptorBuilder.java
@@ -88,7 +88,7 @@ class DescriptorBuilder {
   public String toString() {
     if (!this.finalized) {
       this.finalized = true;
-      this.value = this.parts.stream().map(part -> part.toString())
+      this.value = this.parts.stream().map(Object::toString)
           .collect(Collectors.joining(""));
       this.parts.clear(); // not needed anymore
       this.lastPart = null;
diff --git a/src/main/java/org/torproject/metrics/collector/webstats/SanitizeWeblogs.java b/src/main/java/org/torproject/metrics/collector/webstats/SanitizeWeblogs.java
index 32d4702..f3fbf43 100644
--- a/src/main/java/org/torproject/metrics/collector/webstats/SanitizeWeblogs.java
+++ b/src/main/java/org/torproject/metrics/collector/webstats/SanitizeWeblogs.java
@@ -264,9 +264,9 @@ public class SanitizeWeblogs extends CollecTorMain {
       br.close();
       return lists.parallelStream()
           .map(list -> list.stream()
-              .map(line -> sanitize(line))
-              .filter(line -> line.isPresent())
-              .map(line -> line.get())
+              .map(SanitizeWeblogs::sanitize)
+              .filter(Optional::isPresent)
+              .map(Optional::get)
               .collect(groupingBy(WebServerAccessLogLine::getDate,
                   groupingBy(WebServerAccessLogLine::toLogString, counting()))))
           .flatMap(map -> map.entrySet().stream()).parallel()



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits