void (@NotNull Disposable disposable) { // If isDisposing is true, there is no point of modifying the myDisposables list since it's going to be cleared anyway. if (!isDisposing) { for (int i = myDisposables.size() - 1; i >= 0; i--) { Disposable d = myDisposables.get(i); if (d == disposable) { // Compare by identity. myDisposables.remove(i); } } } }