ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/main/java/util/TreeSet.java
(Generate patch)

Comparing jsr166/src/main/java/util/TreeSet.java (file contents):
Revision 1.21 by dl, Wed Apr 19 15:07:14 2006 UTC vs.
Revision 1.24 by jsr166, Tue May 9 21:55:10 2006 UTC

# Line 56 | Line 56 | package java.util;
56   * should be used only to detect bugs.</i>
57   *
58   * <p>This class is a member of the
59 < * <a href="{@docRoot}/../guide/collections/index.html">
59 > * <a href="{@docRoot}/../technotes/guides/collections/index.html">
60   * Java Collections Framework</a>.
61   *
62   * @param <E> the type of elements maintained by this set
# Line 75 | Line 75 | package java.util;
75   public class TreeSet<E> extends AbstractSet<E>
76      implements NavigableSet<E>, Cloneable, java.io.Serializable
77   {
78 <    /**
78 >    /**
79       * The backing map.
80       */
81 <    private transient NavigableMap<E,Object> m;
81 >    private transient NavigableMap<E,Object> m;
82  
83      // Dummy value to associate with an Object in the backing Map
84      private static final Object PRESENT = new Object();
# Line 100 | Line 100 | public class TreeSet<E> extends Abstract
100       * {@code e2} in the set.  If the user attempts to add an element
101       * to the set that violates this constraint (for example, the user
102       * attempts to add a string element to a set whose elements are
103 <     * integers), the {@code add(Object)} call will throw a
103 >     * integers), the {@code add} call will throw a
104       * {@code ClassCastException}.
105       */
106      public TreeSet() {
# Line 114 | Line 114 | public class TreeSet<E> extends Abstract
114       * e2)} must not throw a {@code ClassCastException} for any elements
115       * {@code e1} and {@code e2} in the set.  If the user attempts to add
116       * an element to the set that violates this constraint, the
117 <     * {@code add(Object)} call will throw a {@code ClassCastException}.
117 >     * {@code add} call will throw a {@code ClassCastException}.
118       *
119       * @param comparator the comparator that will be used to order this set.
120       *        If {@code null}, the {@linkplain Comparable natural
# Line 203 | Line 203 | public class TreeSet<E> extends Abstract
203       * Returns {@code true} if this set contains the specified element.
204       * More formally, returns {@code true} if and only if this set
205       * contains an element {@code e} such that
206 <     * {@code (o==null&nbsp;?&nbsp;e==null&nbsp;:&nbsp;o.equals(e))}.
206 >     * <tt>(o==null&nbsp;?&nbsp;e==null&nbsp;:&nbsp;o.equals(e))</tt>.
207       *
208       * @param o object to be checked for containment in this set
209       * @return {@code true} if this set contains the specified element
# Line 221 | Line 221 | public class TreeSet<E> extends Abstract
221       * Adds the specified element to this set if it is not already present.
222       * More formally, adds the specified element {@code e} to this set if
223       * the set contains no element {@code e2} such that
224 <     * {@code (e==null&nbsp;?&nbsp;e2==null&nbsp;:&nbsp;e.equals(e2))}.
224 >     * <tt>(e==null&nbsp;?&nbsp;e2==null&nbsp;:&nbsp;e.equals(e2))</tt>.
225       * If this set already contains the element, the call leaves the set
226       * unchanged and returns {@code false}.
227       *
# Line 241 | Line 241 | public class TreeSet<E> extends Abstract
241      /**
242       * Removes the specified element from this set if it is present.
243       * More formally, removes an element {@code e} such that
244 <     * {@code (o==null&nbsp;?&nbsp;e==null&nbsp;:&nbsp;o.equals(e))},
244 >     * <tt>(o==null&nbsp;?&nbsp;e==null&nbsp;:&nbsp;o.equals(e))</tt>,
245       * if this set contains such an element.  Returns {@code true} if
246       * this set contained the element (or equivalently, if this set
247       * changed as a result of the call).  (This set will not contain the
# Line 303 | Line 303 | public class TreeSet<E> extends Abstract
303       * @throws IllegalArgumentException {@inheritDoc}
304       * @since 1.6
305       */
306 <    public NavigableSet<E> navigableSubSet(E fromElement, boolean fromInclusive,
307 <                                           E toElement,   boolean toInclusive) {
308 <        return new TreeSet<E>(m.navigableSubMap(fromElement, fromInclusive,
309 <                                                toElement,   toInclusive));
306 >    public NavigableSet<E> subSet(E fromElement, boolean fromInclusive,
307 >                                  E toElement,   boolean toInclusive) {
308 >        return new TreeSet<E>(m.subMap(fromElement, fromInclusive,
309 >                                       toElement,   toInclusive));
310      }
311  
312      /**
# Line 317 | Line 317 | public class TreeSet<E> extends Abstract
317       * @throws IllegalArgumentException {@inheritDoc}
318       * @since 1.6
319       */
320 <    public NavigableSet<E> navigableHeadSet(E toElement, boolean inclusive) {
321 <        return new TreeSet<E>(m.navigableHeadMap(toElement, inclusive));
320 >    public NavigableSet<E> headSet(E toElement, boolean inclusive) {
321 >        return new TreeSet<E>(m.headMap(toElement, inclusive));
322      }
323  
324      /**
# Line 329 | Line 329 | public class TreeSet<E> extends Abstract
329       * @throws IllegalArgumentException {@inheritDoc}
330       * @since 1.6
331       */
332 <    public NavigableSet<E> navigableTailSet(E fromElement, boolean inclusive) {
333 <        return new TreeSet<E>(m.navigableTailMap(fromElement, inclusive));
332 >    public NavigableSet<E> tailSet(E fromElement, boolean inclusive) {
333 >        return new TreeSet<E>(m.tailMap(fromElement, inclusive));
334      }
335  
336      /**
# Line 341 | Line 341 | public class TreeSet<E> extends Abstract
341       * @throws IllegalArgumentException {@inheritDoc}
342       */
343      public SortedSet<E> subSet(E fromElement, E toElement) {
344 <        return navigableSubSet(fromElement, true, toElement, false);
344 >        return subSet(fromElement, true, toElement, false);
345      }
346  
347      /**
# Line 352 | Line 352 | public class TreeSet<E> extends Abstract
352       * @throws IllegalArgumentException {@inheritDoc}
353       */
354      public SortedSet<E> headSet(E toElement) {
355 <        return navigableHeadSet(toElement, false);
355 >        return headSet(toElement, false);
356      }
357  
358      /**
# Line 363 | Line 363 | public class TreeSet<E> extends Abstract
363       * @throws IllegalArgumentException {@inheritDoc}
364       */
365      public SortedSet<E> tailSet(E fromElement) {
366 <        return navigableTailSet(fromElement, true);
366 >        return tailSet(fromElement, true);
367      }
368  
369      public Comparator<? super E> comparator() {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines