harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hinde...@apache.org
Subject svn commit: r469119 - in /incubator/harmony/enhanced/classlib/trunk/modules/luni/src: main/java/java/util/TreeMap.java test/java/tests/api/java/util/TreeMapTest.java
Date Mon, 30 Oct 2006 11:04:26 GMT
Author: hindessm
Date: Mon Oct 30 03:04:25 2006
New Revision: 469119

URL: http://svn.apache.org/viewvc?view=rev&rev=469119
Log:
Fixing cut and paste error in TreeMap.

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/TreeMap.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/TreeMapTest.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/TreeMap.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/TreeMap.java?view=diff&rev=469119&r1=469118&r2=469119
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/TreeMap.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/TreeMap.java
Mon Oct 30 03:04:25 2006
@@ -385,9 +385,9 @@
                 if (hasStart) {
                     Comparator<? super K> cmp = backingMap.comparator;
                     if (cmp == null) {
-                        return (toComparable(key).compareTo(endKey) >= 0);
+                        return (toComparable(key).compareTo(startKey) >= 0);
                     }
-                    return (cmp.compare(key, endKey) >= 0);
+                    return (cmp.compare(key, startKey) >= 0);
                 }
                 return true;
             }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/TreeMapTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/TreeMapTest.java?view=diff&rev=469119&r1=469118&r2=469119
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/TreeMapTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/TreeMapTest.java
Mon Oct 30 03:04:25 2006
@@ -396,12 +396,22 @@
 		assertEquals("end key less than start key should throw IllegalArgumentException",
 				1, result);
         
-        // Regression for Harmony-1161
-        TreeMap<String, String> treeMapWithNull = new TreeMap<String, String>(new
MockComparatorNullTolerable());
-        treeMapWithNull.put("key1" , "value1"); //$NON-NLS-1$ //$NON-NLS-2$
-        treeMapWithNull.put(null, "value2"); //$NON-NLS-1$
-        SortedMap<String, String> subMapWithNull =  treeMapWithNull.subMap( null, "key1");
//$NON-NLS-1$
-        assertEquals("Size of subMap should be 1:", 1, subMapWithNull.size()); //$NON-NLS-1$
+                // Regression for Harmony-1161
+                TreeMap<String, String> treeMapWithNull = new TreeMap<String, String>(new
MockComparatorNullTolerable());
+                treeMapWithNull.put("key1" , "value1"); //$NON-NLS-1$ //$NON-NLS-2$
+                treeMapWithNull.put(null, "value2"); //$NON-NLS-1$
+                SortedMap<String, String> subMapWithNull =  treeMapWithNull.subMap(
null, "key1"); //$NON-NLS-1$
+                assertEquals("Size of subMap should be 1:", 1, subMapWithNull.size()); //$NON-NLS-1$
+
+                // Regression test for typo in lastKey method
+                SortedMap<String, String> map = new TreeMap<String, String>();
+                map.put("1", "one"); //$NON-NLS-1$ //$NON-NLS-2$
+                map.put("2", "two"); //$NON-NLS-1$ //$NON-NLS-2$
+                map.put("3", "three"); //$NON-NLS-1$ //$NON-NLS-2$
+                System.out.println("Last: " + map.lastKey());
+                SortedMap<String, String> sub =
+                    map.subMap( "1", "3"); //$NON-NLS-1$ //$NON-NLS-2$
+                assertEquals("2", sub.lastKey()); //$NON-NLS-1$
 	}
 
 	/**



Mime
View raw message