harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apetre...@apache.org
Subject svn commit: r601752 [3/3] - in /harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util: TreeMap.java TreeSet.java
Date Thu, 06 Dec 2007 15:00:16 GMT
Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/TreeSet.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/TreeSet.java?rev=601752&r1=601751&r2=601752&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/TreeSet.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/TreeSet.java Thu
Dec  6 07:00:16 2007
@@ -387,18 +387,10 @@
                 .readObject());
         int size = stream.readInt();
         if (size > 0) {
-            E key = (E) stream.readObject();
-            TreeMap.Entry<E, E> last = new TreeMap.Entry<E, E>(key, key);
-            map.root = last;
-            map.size = 1;
-            for (int i = 1; i < size; i++) {
-                key = (E) stream.readObject();
-                TreeMap.Entry<E, E> x = new TreeMap.Entry<E, E>(key, key);
-                x.parent = last;
-                last.right = x;
-                map.size++;
-                map.balance(x);
-                last = x;
+            TreeMap.Node<E,E> lastNode = null;
+            for(int i=0; i<size; i++) {
+                E elem = (E)stream.readObject();
+                lastNode = map.addToLast(lastNode,elem,elem);
             }
         }
         backingMap = map;



Mime
View raw message