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

[tor-commits] [metrics-lib/master] Use more powerful Map methods.



commit 27fe727b7c830195d41deb1840165227ca01ba97
Author: Karsten Loesing <karsten.loesing@xxxxxxx>
Date:   Mon Aug 20 15:20:45 2018 +0200

    Use more powerful Map methods.
---
 src/main/java/org/torproject/descriptor/impl/DescriptorImpl.java | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/src/main/java/org/torproject/descriptor/impl/DescriptorImpl.java b/src/main/java/org/torproject/descriptor/impl/DescriptorImpl.java
index 2e7b0f9..70fe7c6 100644
--- a/src/main/java/org/torproject/descriptor/impl/DescriptorImpl.java
+++ b/src/main/java/org/torproject/descriptor/impl/DescriptorImpl.java
@@ -354,11 +354,7 @@ public abstract class DescriptorImpl implements Descriptor {
   }
 
   protected int getKeyCount(Key key) {
-    if (!this.parsedKeys.containsKey(key)) {
-      return 0;
-    } else {
-      return this.parsedKeys.get(key);
-    }
+    return this.parsedKeys.getOrDefault(key, 0);
   }
 
   protected void clearParsedKeys() {



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