Skip to content

Commit 0b4ca83

Browse files
committed
Update the sorted set to immutable
1 parent c923c34 commit 0b4ca83

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

java/src/org/openqa/selenium/grid/config/CompoundConfig.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
package org.openqa.selenium.grid.config;
1919

2020
import java.util.Collection;
21+
import java.util.Collections;
22+
import java.util.Comparator;
2123
import java.util.List;
2224
import java.util.Optional;
2325
import java.util.Set;
@@ -58,7 +60,10 @@ public Set<String> getSectionNames() {
5860
return allConfigs.stream()
5961
.map(Config::getSectionNames)
6062
.flatMap(Collection::stream)
61-
.collect(Collectors.toCollection(TreeSet::new));
63+
.collect(Collectors.collectingAndThen(
64+
Collectors.toCollection(TreeSet::new),
65+
Collections::unmodifiableSortedSet
66+
));
6267
}
6368

6469
@Override
@@ -68,6 +73,9 @@ public Set<String> getOptions(String section) {
6873
return allConfigs.stream()
6974
.map(config -> config.getOptions(section))
7075
.flatMap(Collection::stream)
71-
.collect(Collectors.toCollection(TreeSet::new));
76+
.collect(Collectors.collectingAndThen(
77+
Collectors.toCollection(TreeSet::new),
78+
Collections::unmodifiableSortedSet
79+
));
7280
}
7381
}

0 commit comments

Comments
 (0)