Skip to content

Commit 6fe0c00

Browse files
committed
optimize map creation
1 parent db6123e commit 6fe0c00

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

java/src/org/openqa/selenium/bidi/network/SetCacheBehaviorParameters.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
package org.openqa.selenium.bidi.network;
1919

20+
import java.util.HashMap;
2021
import java.util.List;
2122
import java.util.Map;
2223
import org.openqa.selenium.internal.Require;
@@ -35,10 +36,11 @@ public SetCacheBehaviorParameters(CacheBehavior cacheBehavior, List<String> cont
3536
}
3637

3738
public Map<String, Object> toMap() {
38-
Map<String, Object> map = Map.of("cacheBehavior", cacheBehavior.toString());
39+
Map<String, Object> map = new HashMap<>();
40+
map.put("cacheBehavior", cacheBehavior.toString());
3941

4042
if (contexts != null && !contexts.isEmpty()) {
41-
return Map.of("cacheBehavior", cacheBehavior.toString(), "contexts", contexts);
43+
map.put("contexts", contexts);
4244
}
4345

4446
return map;

0 commit comments

Comments
 (0)