mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
8209003: Consolidate use of empty collections in java.lang.module
Reviewed-by: alanb, mchung
This commit is contained in:
parent
3be8d256e9
commit
db4913ba5a
14 changed files with 76 additions and 122 deletions
|
@ -173,7 +173,7 @@ public final class ModuleLayer {
|
|||
|
||||
Map<String, Module> map;
|
||||
if (parents.isEmpty()) {
|
||||
map = Collections.emptyMap();
|
||||
map = Map.of();
|
||||
} else {
|
||||
map = Module.defineModules(cf, clf, this);
|
||||
}
|
||||
|
@ -811,8 +811,7 @@ public final class ModuleLayer {
|
|||
public Set<Module> modules() {
|
||||
Set<Module> modules = this.modules;
|
||||
if (modules == null) {
|
||||
this.modules = modules =
|
||||
Collections.unmodifiableSet(new HashSet<>(nameToModule.values()));
|
||||
this.modules = modules = Set.copyOf(nameToModule.values());
|
||||
}
|
||||
return modules;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue