Replace FluentIterable with Java Stream

Change-Id: I85e60de5e153168d357ffe1150999c68ddd75712
diff --git a/src/main/java/com/googlesource/gerrit/plugins/its/base/its/ItsConfig.java b/src/main/java/com/googlesource/gerrit/plugins/its/base/its/ItsConfig.java
index c09d071..502a507 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/its/base/its/ItsConfig.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/its/base/its/ItsConfig.java
@@ -14,10 +14,8 @@
 
 package com.googlesource.gerrit.plugins.its.base.its;
 
-import com.google.common.base.Function;
-import com.google.common.base.Optional;
-import com.google.common.base.Predicate;
-import com.google.common.collect.FluentIterable;
+import static java.util.stream.Collectors.toList;
+
 import com.google.gerrit.common.data.RefConfigSection;
 import com.google.gerrit.extensions.annotations.PluginName;
 import com.google.gerrit.extensions.api.projects.CommentLinkInfo;
@@ -42,6 +40,7 @@
 import com.googlesource.gerrit.plugins.its.base.validation.ItsAssociationPolicy;
 import java.util.Collections;
 import java.util.List;
+import java.util.Optional;
 import java.util.regex.Pattern;
 import org.eclipse.jgit.lib.Config;
 import org.slf4j.Logger;
@@ -195,22 +194,11 @@
    */
   public Pattern getIssuePattern() {
     Optional<String> match =
-        FluentIterable.from(getCommentLinkInfo(getCommentLinkName()))
-            .filter(
-                new Predicate<CommentLinkInfo>() {
-                  @Override
-                  public boolean apply(CommentLinkInfo input) {
-                    return input.match != null && !input.match.trim().isEmpty();
-                  }
-                })
-            .transform(
-                new Function<CommentLinkInfo, String>() {
-                  @Override
-                  public String apply(CommentLinkInfo input) {
-                    return input.match;
-                  }
-                })
-            .last();
+        getCommentLinkInfo(getCommentLinkName())
+            .stream()
+            .filter(input -> input.match != null && !input.match.trim().isEmpty())
+            .map(input -> input.match)
+            .reduce((a, b) -> b);
 
     String defPattern = gerritConfig.getString("commentlink", getCommentLinkName(), "match");
 
@@ -218,7 +206,7 @@
       return null;
     }
 
-    return Pattern.compile(match.or(defPattern));
+    return Pattern.compile(match.orElse(defPattern));
   }
 
   /**
@@ -282,15 +270,10 @@
     NameKey projectName = currentProjectName.get();
     if (projectName != null) {
       List<CommentLinkInfo> commentlinks = projectCache.get(projectName).getCommentLinks();
-      return FluentIterable.from(commentlinks)
-          .filter(
-              new Predicate<CommentLinkInfo>() {
-                @Override
-                public boolean apply(CommentLinkInfo input) {
-                  return input.name.equals(commentlinkName);
-                }
-              })
-          .toList();
+      return commentlinks
+          .stream()
+          .filter(input -> input.name.equals(commentlinkName))
+          .collect(toList());
     }
     return Collections.emptyList();
   }