そこで、クラス TreeSet のメソッド remove() を見ていましたが、メソッドの戻り値の型は boolean です。Java API は、削除したいアイテムがツリー内にあり、削除された場合、メソッドが true を返すことを示しています。アイテムがツリーにない場合、または既に削除されている場合、このメソッドは例外を発生させますか? 要素が削除されていない場合に false を返すようにメソッドを変更できますか?
remove
public boolean remove(Object o)
Removes the specified element from this set if it is present.(...)
Returns true if this set contained the element (or equivalently, if this set changed as a result of the call). (This set will not contain the element once the call returns.)