harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lvj...@apache.org
Subject svn commit: r727339 [3/5] - in /harmony/enhanced/classlib/branches/java6/modules/luni/src: main/java/java/util/ test/api/common/org/apache/harmony/luni/tests/java/util/
Date Wed, 17 Dec 2008 10:40:46 GMT
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/TreeSet.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/TreeSet.java?rev=727339&r1=727338&r2=727339&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/TreeSet.java
(original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/TreeSet.java
Wed Dec 17 02:40:45 2008
@@ -506,18 +506,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