Fixed size priority queue
Two thoughts:


If there is other code and you need all the features of a TreeSet great, otherwise delegate to a TreeSet member variable.
Your code if (capacity &lt;= 0) is somewhat superfluous because of the next test if (size() &lt; capacity)