Use Java 11 methods where possible (#6700)

This commit is contained in:
Basil Crow authored and GitHub committed 2022-06-30 09:31:36 -07:00
1 parent 1a6d9f079d
commit 6d179998e1
148 files changed
+419 -527

No files matched your search

@@ -560,7 +560,7 @@ public abstract class ExtensionFinder implements ExtensionPoint {
}
public List<IndexItem<?, Object>> getLoadedIndex() {
return Collections.unmodifiableList(new ArrayList<>(loadedIndex));
return List.copyOf(loadedIndex);
}
@Override
@@ -645,7 +645,7 @@ public abstract class ExtensionFinder implements ExtensionPoint {
// 5. dead lock
if (indices == null) {
ClassLoader cl = Jenkins.get().getPluginManager().uberClassLoader;
indices = Collections.unmodifiableList(StreamSupport.stream(Index.load(Extension.class, Object.class, cl).spliterator(), false).collect(Collectors.toList()));
indices = StreamSupport.stream(Index.load(Extension.class, Object.class, cl).spliterator(), false).collect(Collectors.toUnmodifiableList());
}
return indices;
}