Replace contains/put/get pattern with computeIfAbsent
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2020 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -108,12 +108,7 @@ public class ClassLoaderFiles implements ClassLoaderFileRepository, Serializable
|
||||
* @return an existing or newly added {@link SourceDirectory}
|
||||
*/
|
||||
protected final SourceDirectory getOrCreateSourceDirectory(String name) {
|
||||
SourceDirectory sourceDirectory = this.sourceDirectories.get(name);
|
||||
if (sourceDirectory == null) {
|
||||
sourceDirectory = new SourceDirectory(name);
|
||||
this.sourceDirectories.put(name, sourceDirectory);
|
||||
}
|
||||
return sourceDirectory;
|
||||
return this.sourceDirectories.computeIfAbsent(name, (key) -> new SourceDirectory(name));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user