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(); |
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 |
|
/** |
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 |
|
/** |
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 |
|
/** |
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 |
|
/** |
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 |
|
/** |
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() { |