1 |
|
/* |
2 |
< |
* %W% %E% |
2 |
> |
* Copyright 1998-2006 Sun Microsystems, Inc. All Rights Reserved. |
3 |
> |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
|
* |
5 |
< |
* Copyright 2006 Sun Microsystems, Inc. All rights reserved. |
6 |
< |
* SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. |
5 |
> |
* This code is free software; you can redistribute it and/or modify it |
6 |
> |
* under the terms of the GNU General Public License version 2 only, as |
7 |
> |
* published by the Free Software Foundation. Sun designates this |
8 |
> |
* particular file as subject to the "Classpath" exception as provided |
9 |
> |
* by Sun in the LICENSE file that accompanied this code. |
10 |
> |
* |
11 |
> |
* This code is distributed in the hope that it will be useful, but WITHOUT |
12 |
> |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
13 |
> |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
14 |
> |
* version 2 for more details (a copy is included in the LICENSE file that |
15 |
> |
* accompanied this code). |
16 |
> |
* |
17 |
> |
* You should have received a copy of the GNU General Public License version |
18 |
> |
* 2 along with this work; if not, write to the Free Software Foundation, |
19 |
> |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
20 |
> |
* |
21 |
> |
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
22 |
> |
* CA 95054 USA or visit www.sun.com if you need additional information or |
23 |
> |
* have any questions. |
24 |
|
*/ |
25 |
|
|
26 |
|
package java.util; |
74 |
|
* should be used only to detect bugs.</i> |
75 |
|
* |
76 |
|
* <p>This class is a member of the |
77 |
< |
* <a href="{@docRoot}/../guide/collections/index.html"> |
77 |
> |
* <a href="{@docRoot}/../technotes/guides/collections/index.html"> |
78 |
|
* Java Collections Framework</a>. |
79 |
|
* |
80 |
|
* @param <E> the type of elements maintained by this set |
118 |
|
* {@code e2} in the set. If the user attempts to add an element |
119 |
|
* to the set that violates this constraint (for example, the user |
120 |
|
* attempts to add a string element to a set whose elements are |
121 |
< |
* integers), the {@code add(Object)} call will throw a |
121 |
> |
* integers), the {@code add} call will throw a |
122 |
|
* {@code ClassCastException}. |
123 |
|
*/ |
124 |
|
public TreeSet() { |
132 |
|
* e2)} must not throw a {@code ClassCastException} for any elements |
133 |
|
* {@code e1} and {@code e2} in the set. If the user attempts to add |
134 |
|
* an element to the set that violates this constraint, the |
135 |
< |
* {@code add(Object)} call will throw a {@code ClassCastException}. |
135 |
> |
* {@code add} call will throw a {@code ClassCastException}. |
136 |
|
* |
137 |
|
* @param comparator the comparator that will be used to order this set. |
138 |
|
* If {@code null}, the {@linkplain Comparable natural |
221 |
|
* Returns {@code true} if this set contains the specified element. |
222 |
|
* More formally, returns {@code true} if and only if this set |
223 |
|
* contains an element {@code e} such that |
224 |
< |
* {@code (o==null ? e==null : o.equals(e))}. |
224 |
> |
* <tt>(o==null ? e==null : o.equals(e))</tt>. |
225 |
|
* |
226 |
|
* @param o object to be checked for containment in this set |
227 |
|
* @return {@code true} if this set contains the specified element |
239 |
|
* Adds the specified element to this set if it is not already present. |
240 |
|
* More formally, adds the specified element {@code e} to this set if |
241 |
|
* the set contains no element {@code e2} such that |
242 |
< |
* {@code (e==null ? e2==null : e.equals(e2))}. |
242 |
> |
* <tt>(e==null ? e2==null : e.equals(e2))</tt>. |
243 |
|
* If this set already contains the element, the call leaves the set |
244 |
|
* unchanged and returns {@code false}. |
245 |
|
* |
259 |
|
/** |
260 |
|
* Removes the specified element from this set if it is present. |
261 |
|
* More formally, removes an element {@code e} such that |
262 |
< |
* {@code (o==null ? e==null : o.equals(e))}, |
262 |
> |
* <tt>(o==null ? e==null : o.equals(e))</tt>, |
263 |
|
* if this set contains such an element. Returns {@code true} if |
264 |
|
* this set contained the element (or equivalently, if this set |
265 |
|
* changed as a result of the call). (This set will not contain the |