Merge "Suppress warnings with suggested coding patterns."
diff --git a/src/main/java/com/googlesource/gerrit/plugins/findowners/Cache.java b/src/main/java/com/googlesource/gerrit/plugins/findowners/Cache.java
index 62b124d..ce5ca6e 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/findowners/Cache.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/findowners/Cache.java
@@ -209,11 +209,8 @@
   }
 
   public static Cache getInstance(Config config, GitRepositoryManager repoManager) {
-    Cache cache = cacheMap.get(repoManager);
-    if (cache == null) {
-      cache = new Cache(config);
-      cacheMap.put(repoManager, cache);
-    }
+    Cache cache =
+        cacheMap.computeIfAbsent(repoManager, (GitRepositoryManager k) -> new Cache(config));
     cache.config = config; // Always use newest config, although dbCache could have older data.
     return cache;
   }
diff --git a/src/main/java/com/googlesource/gerrit/plugins/findowners/Util.java b/src/main/java/com/googlesource/gerrit/plugins/findowners/Util.java
index f75a5b5..8802b82 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/findowners/Util.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/findowners/Util.java
@@ -14,6 +14,7 @@
 
 package com.googlesource.gerrit.plugins.findowners;
 
+import com.google.common.base.Ascii;
 import com.google.common.collect.Ordering;
 import java.io.File;
 import java.io.IOException;
@@ -83,7 +84,8 @@
   }
 
   static boolean parseBoolean(String s) {
-    return (s != null) && (s.equals("1") || s.equalsIgnoreCase("yes") || Boolean.parseBoolean(s));
+    return (s != null)
+        && (s.equals("1") || Ascii.equalsIgnoreCase(s, "yes") || Boolean.parseBoolean(s));
   }
 
   static SortedMap<String, List<String>> makeSortedMap(Map<String, Set<String>> map) {
@@ -95,9 +97,7 @@
   }
 
   static void addKeyToMap(Map<String, Set<String>> map, String key) {
-    if (map.get(key) == null) {
-      map.put(key, new HashSet<>());
-    }
+    map.computeIfAbsent(key, (String k) -> new HashSet<>());
   }
 
   static void addToMap(Map<String, Set<String>> map, String key, String value) {
@@ -109,4 +109,6 @@
     addKeyToMap(map, key);
     map.get(key).addAll(values);
   }
+
+  private Util() {}
 }