/** * Removes the <tt>s</tt> smallest and <tt>l</tt> largest elements from the receiver. The * receivers size will be reduced by <tt>s + l</tt> elements. * * @param s the number of smallest elements to trim away (<tt>s >= 0</tt>). * @param l the number of largest elements to trim away (<tt>l >= 0</tt>). */ public synchronized void trim(int s, int l) { DoubleArrayList elems = sortedElements(); clear(); addAllOfFromTo(elems, s, elems.size() - 1 - l); }