6 |
|
*/ |
7 |
|
|
8 |
|
package java.util; |
9 |
+ |
import java.util.*; // for javadoc |
10 |
|
|
11 |
|
/** |
12 |
|
* A Red-Black tree based {@link NavigableMap} implementation. |
1067 |
|
} |
1068 |
|
|
1069 |
|
public boolean containsKey(Object key) { |
1070 |
< |
return inRange((K) key) && TreeMap.this.containsKey(key); |
1070 |
> |
return inRange(key) && TreeMap.this.containsKey(key); |
1071 |
|
} |
1072 |
|
|
1073 |
|
public V get(Object key) { |
1074 |
< |
if (!inRange((K) key)) |
1074 |
> |
if (!inRange(key)) |
1075 |
|
return null; |
1076 |
|
return TreeMap.this.get(key); |
1077 |
|
} |
1083 |
|
} |
1084 |
|
|
1085 |
|
public V remove(Object key) { |
1086 |
< |
if (!inRange((K) key)) |
1086 |
> |
if (!inRange(key)) |
1087 |
|
return null; |
1088 |
|
return TreeMap.this.remove(key); |
1089 |
|
} |
1352 |
|
return navigableTailMap(fromKey); |
1353 |
|
} |
1354 |
|
|
1355 |
< |
private boolean inRange(K key) { |
1355 |
> |
private boolean inRange(Object key) { |
1356 |
|
return (fromStart || compare(key, fromKey) >= 0) && |
1357 |
|
(toEnd || compare(key, toKey) < 0); |
1358 |
|
} |
1359 |
|
|
1360 |
|
// This form allows the high endpoint (as well as all legit keys) |
1361 |
< |
private boolean inRange2(K key) { |
1361 |
> |
private boolean inRange2(Object key) { |
1362 |
|
return (fromStart || compare(key, fromKey) >= 0) && |
1363 |
|
(toEnd || compare(key, toKey) <= 0); |
1364 |
|
} |
1520 |
|
} |
1521 |
|
|
1522 |
|
/** |
1523 |
< |
* Test two values for equality. Differs from o1.equals(o2) only in |
1523 |
> |
* Test two values for equality. Differs from o1.equals(o2) only in |
1524 |
|
* that it copes with <tt>null</tt> o1 properly. |
1525 |
|
*/ |
1526 |
|
private static boolean valEquals(Object o1, Object o2) { |