public Boolean apply(T t, Boolean allSuccess) { return add(t) && allSuccess; } });
@Override public boolean remove(Object o) { if (o instanceof ActivityItem) { return remove((ActivityItem)o); } else { log.warn("Attempting to remove a non-ActivityItem from the set"); return super.remove(o); } }
/** * Returns true if the object was added. If the bound has already been reached, and this element is greater than the * greatest, then it doesn't get added. * * @param o The object to add. * @return See above */ @Override public boolean add(T o) { boolean added = backingSet.add(o); if (!added) { return false; } if (backingSet.size() > maxSize) { T removed = backingSet.last(); remove(removed); if (removed == o) { return false; } } return true; }
public boolean remove(ActivityItem activityItem) { evictor.apply(activityItem.getEntity()); return super.remove(activityItem); }