Skip to content

Commit

Permalink
[java] More conversion of guava-style code to java 8
Browse files Browse the repository at this point in the history
  • Loading branch information
barancev committed Apr 25, 2020
1 parent 6cb00fd commit cedde80
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
1 change: 0 additions & 1 deletion java/client/src/org/openqa/selenium/chrome/BUILD.bazel
Expand Up @@ -19,6 +19,5 @@ java_export(
"//java/client/src/org/openqa/selenium/json",
"//java/client/src/org/openqa/selenium/remote",
"//java/client/src/org/openqa/selenium/remote/http",
artifact("com.google.guava:guava"),
],
)
Expand Up @@ -17,8 +17,9 @@

package org.openqa.selenium.chrome;

import static java.util.Collections.unmodifiableList;

import com.google.auto.service.AutoService;
import com.google.common.collect.ImmutableList;

import org.openqa.selenium.Capabilities;
import org.openqa.selenium.WebDriverException;
Expand All @@ -28,6 +29,7 @@
import java.io.File;
import java.io.IOException;
import java.time.Duration;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

Expand Down Expand Up @@ -208,25 +210,26 @@ protected List<String> createArgs() {
}
}

ImmutableList.Builder<String> argsBuilder = ImmutableList.builder();
argsBuilder.add(String.format("--port=%d", getPort()));
List<String> args = new ArrayList<>();

args.add(String.format("--port=%d", getPort()));
if (getLogFile() != null) {
argsBuilder.add(String.format("--log-path=%s", getLogFile().getAbsolutePath()));
args.add(String.format("--log-path=%s", getLogFile().getAbsolutePath()));
}
if (appendLog) {
argsBuilder.add("--append-log");
args.add("--append-log");
}
if (verbose) {
argsBuilder.add("--verbose");
args.add("--verbose");
}
if (silent) {
argsBuilder.add("--silent");
args.add("--silent");
}
if (whitelistedIps != null) {
argsBuilder.add(String.format("--whitelisted-ips=%s", whitelistedIps));
args.add(String.format("--whitelisted-ips=%s", whitelistedIps));
}

return argsBuilder.build();
return unmodifiableList(args);
}

@Override
Expand Down

0 comments on commit cedde80

Please sign in to comment.