mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Map.getOrDefault/putIfAbsent/merge used where safe; warnings fixed
This commit is contained in:
@@ -148,7 +148,7 @@ public class LibraryDownloadSettings {
|
||||
}
|
||||
libraryEditor.setName(myLibraryName);
|
||||
for (Pair<VirtualFile, DownloadableFileDescription> pair : downloaded) {
|
||||
final OrderRootType rootType = rootTypes.containsKey(pair.getSecond()) ? rootTypes.get(pair.getSecond()) : OrderRootType.CLASSES;
|
||||
final OrderRootType rootType = rootTypes.getOrDefault(pair.getSecond(), OrderRootType.CLASSES);
|
||||
libraryEditor.addRoot(pair.getFirst(), rootType);
|
||||
}
|
||||
return libraryEditor;
|
||||
|
||||
@@ -361,9 +361,7 @@ public class JavaPsiFacadeImpl extends JavaPsiFacadeEx {
|
||||
// (the Kotlin plugin can do that), the Java package takes precedence.
|
||||
PsiPackage[] packages = finder.getSubPackages(psiPackage, scope);
|
||||
for (PsiPackage aPackage : packages) {
|
||||
if (result.get(aPackage.getName()) == null) {
|
||||
result.put(aPackage.getName(), aPackage);
|
||||
}
|
||||
result.putIfAbsent(aPackage.getName(), aPackage);
|
||||
}
|
||||
}
|
||||
return result.values().toArray(PsiPackage.EMPTY_ARRAY);
|
||||
|
||||
+1
-1
@@ -642,6 +642,6 @@ public abstract class OptionTreeWithPreviewPanel extends CustomizableLanguageCod
|
||||
}
|
||||
|
||||
private String getRemappedGroup(String fieldName, String defaultName) {
|
||||
return myRemappedGroups.containsKey(fieldName) ? myRemappedGroups.get(fieldName) : defaultName;
|
||||
return myRemappedGroups.getOrDefault(fieldName, defaultName);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,11 +46,7 @@ public class DuplicateMap {
|
||||
SliceNode putNodeCheckDupe(@NotNull final SliceNode node) {
|
||||
return ReadAction.compute(() -> {
|
||||
SliceUsage usage = node.getValue();
|
||||
SliceNode eq = myDuplicates.get(usage);
|
||||
if (eq == null) {
|
||||
myDuplicates.put(usage, node);
|
||||
}
|
||||
return eq;
|
||||
return myDuplicates.putIfAbsent(usage, node);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user