1 |
|
/* |
2 |
|
* %W% %E% |
3 |
|
* |
4 |
< |
* Copyright 2004 Sun Microsystems, Inc. All rights reserved. |
4 |
> |
* Copyright 2005 Sun Microsystems, Inc. All rights reserved. |
5 |
|
* SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. |
6 |
|
*/ |
7 |
|
|
351 |
|
// Offload comparator-based version for sake of performance |
352 |
|
if (comparator != null) |
353 |
|
return getEntryUsingComparator(key); |
354 |
< |
Comparable<K> k = (Comparable<K>) key; |
354 |
> |
Comparable<? super K> k = (Comparable<? super K>) key; |
355 |
|
Entry<K,V> p = root; |
356 |
|
while (p != null) { |
357 |
|
int cmp = k.compareTo(p.key); |
874 |
|
private transient Set<Map.Entry<K,V>> descendingEntrySet = null; |
875 |
|
private transient Set<K> descendingKeySet = null; |
876 |
|
|
877 |
– |
transient Set<K> keySet = null; // XXX remove when integrated |
878 |
– |
transient Collection<V> values = null; // XXX remove when integrated |
879 |
– |
|
877 |
|
/** |
878 |
|
* Returns a Set view of the keys contained in this map. The set's |
879 |
|
* iterator will return the keys in ascending order. The set is backed by |
1338 |
|
TreeMap.Entry<K,V> e = fromStart ? getFirstEntry() : getCeilingEntry(fromKey); |
1339 |
|
K first = key(e); |
1340 |
|
if (!toEnd && compare(first, toKey) >= 0) |
1341 |
< |
throw(new NoSuchElementException()); |
1341 |
> |
throw new NoSuchElementException(); |
1342 |
|
return first; |
1343 |
|
} |
1344 |
|
|
1346 |
|
TreeMap.Entry<K,V> e = toEnd ? getLastEntry() : getLowerEntry(toKey); |
1347 |
|
K last = key(e); |
1348 |
|
if (!fromStart && compare(last, fromKey) < 0) |
1349 |
< |
throw(new NoSuchElementException()); |
1349 |
> |
throw new NoSuchElementException(); |
1350 |
|
return last; |
1351 |
|
} |
1352 |
|
|
1760 |
|
* Compares two keys using the correct comparison method for this TreeMap. |
1761 |
|
*/ |
1762 |
|
private int compare(K k1, K k2) { |
1763 |
< |
return (comparator==null ? ((Comparable</*-*/K>)k1).compareTo(k2) |
1764 |
< |
: comparator.compare((K)k1, (K)k2)); |
1763 |
> |
return comparator==null ? ((Comparable<? super K>)k1).compareTo(k2) |
1764 |
> |
: comparator.compare(k1, k2); |
1765 |
|
} |
1766 |
|
|
1767 |
|
/** |
2193 |
|
} |
2194 |
|
|
2195 |
|
/** Intended to be called only from TreeSet.addAll **/ |
2196 |
< |
void addAllForTreeSet(SortedSet<Map.Entry<K,V>> set, V defaultVal) { |
2196 |
> |
void addAllForTreeSet(SortedSet<? extends K> set, V defaultVal) { |
2197 |
|
try { |
2198 |
|
buildFromSorted(set.size(), set.iterator(), null, defaultVal); |
2199 |
|
} catch (java.io.IOException cannotHappen) { |