boolean (Bookmark bookmark, @NotNull VirtualFile file, @Nullable List<Bookmark> toRemove) { // it's quadratic but oh well. let's hope users are sane enough not to have thousands of bookmarks in one file. for (Bookmark b : myBookmarks.get(file)) { if (b == bookmark) continue; if (!b.isValid()) continue; if (Comparing.equal(b.getFile(), bookmark.getFile()) && b.getLine() == bookmark.getLine()) { if (toRemove == null || !toRemove.contains(b)) { return true; } } } return false; }