Remove redundant keySet/values calls

GitOrigin-RevId: e972012a4ead404120b0f947c79d059f6d96f942
This commit is contained in:
Tagir Valeev
2024-09-18 20:12:20 +02:00
committed by intellij-monorepo-bot
parent a1eecbd0ae
commit d013c9980e
8 changed files with 10 additions and 10 deletions

View File

@@ -187,7 +187,7 @@ public final class HotSwapUIImpl extends HotSwapUI {
}
HotSwapProgressImpl progress = new HotSwapProgressImpl(myProject);
if (modifiedClasses.keySet().size() == 1) {
if (modifiedClasses.size() == 1) {
progress.setSessionForActions(ContainerUtil.getFirstItem(modifiedClasses.keySet()));
}
progress.addProgressListener(delegatingTo(statusListener, sessions, progress));

View File

@@ -215,7 +215,7 @@ public class RootDetectionProcessor {
private List<DetectedRootData> detectRoots() {
Map<ProjectStructureDetector, List<DetectedProjectRoot>> roots = runDetectors();
if (myProgressIndicator != null) {
myProgressIndicator.setText2(JavaUiBundle.message("progress.text.processing.0.project.roots", roots.values().size()));
myProgressIndicator.setText2(JavaUiBundle.message("progress.text.processing.0.project.roots", roots.size()));
}
Map<File, DetectedRootData> rootData = new LinkedHashMap<>();

View File

@@ -86,7 +86,7 @@ public abstract class RedundantSuppressInspectionBase extends GlobalSimpleInspec
}
});
if (suppressedScopes.values().isEmpty()) return ProblemDescriptor.EMPTY_ARRAY;
if (suppressedScopes.isEmpty()) return ProblemDescriptor.EMPTY_ARRAY;
// have to visit all file from scratch since inspections can be written in any pervasive way including checkFile() overriding
Map<InspectionToolWrapper<?, ?>, String> suppressedTools = new HashMap<>();
List<InspectionToolWrapper<?, ?>> toolWrappers = getInspectionTools(psiFile, profile);

View File

@@ -167,7 +167,7 @@ public final class GridImpl extends Wrapper implements Grid, Disposable, UiDataP
}
public ActionCallback restoreLastUiState() {
final ActionCallback result = new ActionCallback(myPlaceInGrid2Cell.values().size());
final ActionCallback result = new ActionCallback(myPlaceInGrid2Cell.size());
for (final GridCellImpl cell : myPlaceInGrid2Cell.values()) {
cell.restoreLastUiState().notifyWhenDone(result);
}

View File

@@ -191,7 +191,7 @@ public class ExternalSystemTasksTree extends Tree implements Supplier<ExternalTa
}
// Disable tasks execution if it comes from different projects
if(map.values().size() != 1) return null;
if(map.size() != 1) return null;
return map.values().iterator().next();
}
}

View File

@@ -29,7 +29,7 @@ public final class OfflineInspectionRVContentProvider extends InspectionRVConten
public boolean checkReportedProblems(@NotNull GlobalInspectionContextImpl context,
final @NotNull InspectionToolWrapper toolWrapper) {
final Map<String, Set<OfflineProblemDescriptor>> content = getFilteredContent(context, toolWrapper);
return content != null && !content.values().isEmpty();
return content != null && !content.isEmpty();
}
@Override
@@ -62,7 +62,7 @@ public final class OfflineInspectionRVContentProvider extends InspectionRVConten
@NotNull Function<? super RefEntity, CommonProblemDescriptor[]> problems) {
final Map<String, Set<OfflineProblemDescriptor>> filteredContent = getFilteredContent(context, wrapper);
InspectionResultsView view = context.getView();
if (filteredContent != null && !filteredContent.values().isEmpty()) {
if (filteredContent != null && !filteredContent.isEmpty()) {
buildTree(context, filteredContent, wrapper, descriptor -> {
final RefEntity element = descriptor.getRefElement(context.getRefManager());
return new RefEntityContainer<OfflineProblemDescriptor>(element, new OfflineProblemDescriptor[] {descriptor}) {

View File

@@ -217,8 +217,8 @@ public final class ImportFromToImportIntention extends PyBaseIntentionAction {
} while (feeler != null);
String top_name = top_qualifier.getName();
Collection<PsiReference> possible_targets = references.keySet();
if (star_references.size() > 0) {
possible_targets = new ArrayList<>(references.keySet().size() + star_references.size());
if (!star_references.isEmpty()) {
possible_targets = new ArrayList<>(references.size() + star_references.size());
possible_targets.addAll(references.keySet());
possible_targets.addAll(star_references);
}

View File

@@ -108,7 +108,7 @@ public class PyTypeParserTest extends PyTestCase {
myFixture.configureByFile("typeParser/typeParser.py");
final String s = "list of (MyObject, collections.Iterable of MyObject, int) or None";
PyTypeParser.ParseResult result = PyTypeParser.parse(myFixture.getFile(), s);
assertEquals(7, result.getTypes().values().size());
assertEquals(7, result.getTypes().size());
}
public void testGenericType() {