IDEA-311645 Inspection suggestion

GitOrigin-RevId: 00de79cc7a235a17737a5af5ae9a6a27b12c5942
This commit is contained in:
Alexandr Evstigneev
2023-02-02 22:43:52 +00:00
committed by intellij-monorepo-bot
parent 1a46db7c1d
commit 01ceb4ebbb
@@ -1,4 +1,4 @@
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.ui.tree;
import com.intellij.openapi.Disposable;
@@ -881,7 +881,7 @@ public final class AsyncTreeModel extends AbstractTreeModel implements Searchabl
}
private void updatePaths(@NotNull Object oldObject, @NotNull Object newObject) {
if (paths.stream().anyMatch(path -> contains(path, oldObject))) {
if (ContainerUtil.exists(paths, path -> contains(path, oldObject))) {
// replace instance of user's object in all internal maps to avoid memory leaks
List<TreePath> updated = ContainerUtil.map(paths, path -> update(path, oldObject, newObject));
paths.clear();