File tree Expand file tree Collapse file tree 1 file changed +7
-10
lines changed
java/src/org/openqa/selenium/remote Expand file tree Collapse file tree 1 file changed +7
-10
lines changed Original file line number Diff line number Diff line change 2323import static org .openqa .selenium .remote .CapabilityType .PLATFORM_NAME ;
2424
2525import java .util .Map ;
26+ import java .util .Optional ;
27+ import org .jspecify .annotations .Nullable ;
2628import org .openqa .selenium .Capabilities ;
2729import org .openqa .selenium .MutableCapabilities ;
2830import org .openqa .selenium .Platform ;
@@ -39,12 +41,8 @@ public DesiredCapabilities() {
3941 // no-arg constructor
4042 }
4143
42- public DesiredCapabilities (Map <String , ?> rawMap ) {
43- if (rawMap == null ) {
44- return ;
45- }
46-
47- rawMap .forEach (this ::setCapability );
44+ public DesiredCapabilities (@ Nullable Map <String , ?> rawMap ) {
45+ Optional .ofNullable (rawMap ).ifPresent (map -> map .forEach (this ::setCapability ));
4846 }
4947
5048 public DesiredCapabilities (Capabilities other ) {
@@ -94,10 +92,9 @@ public void setAcceptInsecureCerts(boolean acceptInsecureCerts) {
9492 * @return DesiredCapabilities after the merge
9593 */
9694 @ Override
97- public DesiredCapabilities merge (Capabilities extraCapabilities ) {
98- if (extraCapabilities != null ) {
99- extraCapabilities .asMap ().forEach (this ::setCapability );
100- }
95+ public DesiredCapabilities merge (@ Nullable Capabilities extraCapabilities ) {
96+ Optional .ofNullable (extraCapabilities )
97+ .ifPresent (caps -> caps .asMap ().forEach (this ::setCapability ));
10198 return this ;
10299 }
103100}
You can’t perform that action at this time.
0 commit comments