17
17
18
18
package org .openqa .selenium ;
19
19
20
- import java .util .Collections ;
21
20
import java .util .Map ;
22
21
import java .util .Set ;
23
22
import java .util .function .Function ;
24
- import java .util .stream .Collector ;
25
23
import java .util .stream .Collectors ;
26
24
import java .util .stream .Stream ;
27
25
import org .openqa .selenium .internal .Require ;
@@ -58,7 +56,7 @@ public PersistentCapabilities setCapability(String name, Object value) {
58
56
@ Override
59
57
public Map <String , Object > asMap () {
60
58
return getCapabilityNames ().stream ()
61
- .collect (toUnmodifiableMap (Function .identity (), this ::getCapability ));
59
+ .collect (Collectors . toUnmodifiableMap (Function .identity (), this ::getCapability ));
62
60
}
63
61
64
62
@ Override
@@ -81,19 +79,7 @@ public Capabilities merge(Capabilities other) {
81
79
public Set <String > getCapabilityNames () {
82
80
return Stream .concat (
83
81
caps .getCapabilityNames ().stream (), overrides .getCapabilityNames ().stream ())
84
- .collect (toUnmodifiableSet ());
85
- }
86
-
87
- // Needed, since we're dependent on Java 8 as a minimum version
88
- private <T , K , U > Collector <T , ?, Map <K , U >> toUnmodifiableMap (
89
- Function <? super T , ? extends K > keyMapper , Function <? super T , ? extends U > valueMapper ) {
90
- return Collectors .collectingAndThen (
91
- Collectors .toMap (keyMapper , valueMapper ), Collections ::unmodifiableMap );
92
- }
93
-
94
- // Needed, since we're dependent on Java 8 as a minimum version
95
- private <T > Collector <T , ?, Set <T >> toUnmodifiableSet () {
96
- return Collectors .collectingAndThen (Collectors .toSet (), Collections ::unmodifiableSet );
82
+ .collect (Collectors .toUnmodifiableSet ());
97
83
}
98
84
99
85
@ Override
0 commit comments