public class SmallestElementSet<E extends java.lang.Comparable<E>>
extends java.util.TreeSet<E>
TreeSet
that keeps only the smallest elements, up to a specified number of maximum elements.Modifier and Type | Field and Description |
---|---|
private int |
maxElementCount |
(package private) static long |
serialVersionUID |
Constructor and Description |
---|
SmallestElementSet(int maxElementCount) |
Modifier and Type | Method and Description |
---|---|
boolean |
add(E element) |
boolean |
addAll(java.util.Collection<? extends E> collection) |
ceiling, clear, clone, comparator, contains, descendingIterator, descendingSet, first, floor, headSet, headSet, higher, isEmpty, iterator, last, lower, pollFirst, pollLast, remove, size, spliterator, subSet, subSet, tailSet, tailSet
containsAll, retainAll, toArray, toArray, toString
finalize, getClass, notify, notifyAll, wait, wait, wait
static final long serialVersionUID
private final int maxElementCount
public SmallestElementSet(int maxElementCount)
maxElementCount
- Maximum number of elements the set will keep