@Override public boolean offer(NameValuePair entry) { updateTotal(entry.value); if (size() == n) { NameValuePair smallest = peek(); if (smallest.value >= entry.value) { return false; } poll(); // remove smallest } return super.offer(entry); }
@Override public boolean offer(NameValuePair entry) { updateTotal(entry.value); if (size() == n) { NameValuePair smallest = peek(); if (smallest.value >= entry.value) { return false; } poll(); // remove smallest } return super.offer(entry); }