boolean (@NotNull Update update) { Map<Update, Update> updates = myScheduledUpdates.get(update.getPriority()); if (updates != null && updates.containsKey(update)) { return false; } for (Update eachInQueue : getAllScheduledUpdates()) { if (eachInQueue.actuallyCanEat(update)) { update.setRejected(); return true; } if (update.actuallyCanEat(eachInQueue)) { myScheduledUpdates.get(eachInQueue.getPriority()).remove(eachInQueue); eachInQueue.setRejected(); } } return false; }