File tree Expand file tree Collapse file tree 4 files changed +21
-5
lines changed
java/src/org/openqa/selenium/grid Expand file tree Collapse file tree 4 files changed +21
-5
lines changed Original file line number Diff line number Diff line change 2525import java .io .Closeable ;
2626import java .time .Duration ;
2727import java .time .Instant ;
28+ import java .util .Collections ;
2829import java .util .Deque ;
2930import java .util .Iterator ;
31+ import java .util .LinkedHashSet ;
3032import java .util .List ;
3133import java .util .Map ;
3234import java .util .Optional ;
@@ -178,7 +180,10 @@ private void timeoutSessions() {
178180 sessionRequest .getRequestId ().equals (entry .getKey ())))
179181 .filter (entry -> isTimedOut (now , entry .getValue ()))
180182 .map (Map .Entry ::getKey )
181- .collect (Collectors .toSet ());
183+ .collect (
184+ Collectors .collectingAndThen (
185+ Collectors .toCollection (LinkedHashSet ::new ),
186+ set -> Collections .unmodifiableSet (new LinkedHashSet <>(set ))));
182187 } finally {
183188 readLock .unlock ();
184189 }
Original file line number Diff line number Diff line change 2121import java .io .IOException ;
2222import java .io .InputStream ;
2323import java .io .UncheckedIOException ;
24+ import java .util .Collections ;
25+ import java .util .LinkedHashSet ;
2426import java .util .Optional ;
2527import java .util .Set ;
2628import java .util .jar .JarFile ;
@@ -100,7 +102,10 @@ public Set<Resource> list() {
100102 .filter (e -> !e .getName ().equals (prefix ))
101103 .filter (e -> e .getName ().split ("/" ).length == count )
102104 .map (e -> new JarFileResource (jarFile , e .getName (), prefix ))
103- .collect (Collectors .toUnmodifiableSet ());
105+ .collect (
106+ Collectors .collectingAndThen (
107+ Collectors .toCollection (LinkedHashSet ::new ),
108+ set -> Collections .unmodifiableSet (new LinkedHashSet <>(set ))));
104109 }
105110
106111 @ Override
Original file line number Diff line number Diff line change 1919
2020import java .util .Collections ;
2121import java .util .HashSet ;
22+ import java .util .LinkedHashSet ;
2223import java .util .Optional ;
2324import java .util .Set ;
2425import org .openqa .selenium .internal .Require ;
@@ -67,9 +68,9 @@ public boolean isDirectory() {
6768
6869 @ Override
6970 public Set <Resource > list () {
70- Set <Resource > resources = new HashSet <>(base .list ());
71+ Set <Resource > resources = new LinkedHashSet <>(base .list ());
7172 next .ifPresent (res -> resources .addAll (res .list ()));
72- return Collections .unmodifiableSet (resources );
73+ return Collections .unmodifiableSet (new LinkedHashSet <>( resources ) );
7374 }
7475
7576 @ Override
Original file line number Diff line number Diff line change 2222import java .nio .file .Files ;
2323import java .nio .file .Path ;
2424import java .util .Arrays ;
25+ import java .util .Collections ;
26+ import java .util .LinkedHashSet ;
2527import java .util .Optional ;
2628import java .util .Set ;
2729import java .util .function .Predicate ;
@@ -88,7 +90,10 @@ public Set<Resource> list() {
8890 return files
8991 .filter (allowedSubpaths )
9092 .map (PathResource ::new )
91- .collect (Collectors .toUnmodifiableSet ());
93+ .collect (
94+ Collectors .collectingAndThen (
95+ Collectors .toCollection (LinkedHashSet ::new ),
96+ set -> Collections .unmodifiableSet (new LinkedHashSet <>(set ))));
9297 } catch (IOException e ) {
9398 throw new UncheckedIOException (e );
9499 }
You can’t perform that action at this time.
0 commit comments