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

Comparing jsr166/src/main/java/util/TreeMap.java (file contents):
Revision 1.16 by dl, Wed May 25 14:05:06 2005 UTC vs.
Revision 1.18 by jsr166, Thu Jun 16 02:11:13 2005 UTC

# Line 6 | Line 6
6   */
7  
8   package java.util;
9 + import java.util.*; // for javadoc
10  
11   /**
12   * A Red-Black tree based {@link NavigableMap} implementation.
# Line 1066 | Line 1067 | public class TreeMap<K,V>
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          }
# Line 1082 | Line 1083 | public class TreeMap<K,V>
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          }
# Line 1351 | Line 1352 | public class TreeMap<K,V>
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          }
# Line 1519 | Line 1520 | public class TreeMap<K,V>
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) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines