未验证 提交 23f08810 编写于 作者: J Jan S 提交者: GitHub

fix(gui): synchronized conditional usageList remove method added (PR #1065)

上级 3bbb6b10
...@@ -5,6 +5,7 @@ import java.util.Collections; ...@@ -5,6 +5,7 @@ import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Predicate;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -29,6 +30,10 @@ public class CodeUsageInfo { ...@@ -29,6 +30,10 @@ public class CodeUsageInfo {
public synchronized void addUsage(CodeNode codeNode) { public synchronized void addUsage(CodeNode codeNode) {
usageList.add(codeNode); usageList.add(codeNode);
} }
public synchronized void removeUsageIf(Predicate<? super CodeNode> filter) {
usageList.removeIf(filter);
}
} }
private final JNodeCache nodeCache; private final JNodeCache nodeCache;
...@@ -76,7 +81,7 @@ public class CodeUsageInfo { ...@@ -76,7 +81,7 @@ public class CodeUsageInfo {
if (e.getKey().getJavaNode().getTopParentClass().equals(cls)) { if (e.getKey().getJavaNode().getTopParentClass().equals(cls)) {
return true; return true;
} }
e.getValue().getUsageList().removeIf(node -> node.getJavaNode().getTopParentClass().equals(cls)); e.getValue().removeUsageIf(node -> node.getJavaNode().getTopParentClass().equals(cls));
return false; return false;
}); });
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册