/** * Sets last-changed if rv is true OR if the peer is already present. * Calls the trimmer if begin == end and we are full. * If begin != end then add it and caller must do bucket splitting. * @return true if added */ public boolean add(T peer) { if (_begin != _end || _entries.size() < _max || _entries.contains(peer) || _trimmer.trim(this, peer)) { // do this even if already contains, to call setLastChanged() boolean rv = _entries.add(peer); setLastChanged(); return rv; } return false; }