Commit 5ace5775 by Bryce McKinlay Committed by Bryce McKinlay

TreeMap.java (nil): Made non-final.

	* java/util/TreeMap.java (nil): Made non-final.
	(clone): Create new nil node for copy.

From-SVN: r39736
parent 729338bb
...@@ -4,6 +4,9 @@ ...@@ -4,6 +4,9 @@
super.clone(), not new. super.clone(), not new.
* java/util/TreeMap.java (clone): Likewise. * java/util/TreeMap.java (clone): Likewise.
* java/util/TreeMap.java (nil): Made non-final.
(clone): Create new nil node for copy.
2001-02-14 Andrew Haley <aph@redhat.com> 2001-02-14 Andrew Haley <aph@redhat.com>
* include/i386-signal.h (INIT_SEGV): Use a direct system call to * include/i386-signal.h (INIT_SEGV): Use a direct system call to
......
...@@ -56,7 +56,7 @@ import java.io.IOException; ...@@ -56,7 +56,7 @@ import java.io.IOException;
* *
* @author Jon Zeppieri * @author Jon Zeppieri
* @author Bryce McKinlay * @author Bryce McKinlay
* @modified $Id: TreeMap.java,v 1.2 2001/02/14 05:32:31 bryce Exp $ * @modified $Id: TreeMap.java,v 1.3 2001/02/16 01:49:40 bryce Exp $
*/ */
public class TreeMap extends AbstractMap public class TreeMap extends AbstractMap
implements SortedMap, Cloneable, Serializable implements SortedMap, Cloneable, Serializable
...@@ -67,7 +67,7 @@ public class TreeMap extends AbstractMap ...@@ -67,7 +67,7 @@ public class TreeMap extends AbstractMap
/** Sentinal node, used to avoid null checks for corner cases and make the /** Sentinal node, used to avoid null checks for corner cases and make the
delete rebalance code simpler. Note that this must not be static, due delete rebalance code simpler. Note that this must not be static, due
to thread-safety concerns. */ to thread-safety concerns. */
transient final Node nil = new Node(null, null); transient Node nil = new Node(null, null);
/** The root node of this TreeMap */ /** The root node of this TreeMap */
transient Node root = nil; transient Node root = nil;
...@@ -186,6 +186,8 @@ public class TreeMap extends AbstractMap ...@@ -186,6 +186,8 @@ public class TreeMap extends AbstractMap
catch (CloneNotSupportedException x) catch (CloneNotSupportedException x)
{ {
} }
// Each instance must have a unique sentinal.
copy.nil = new Node(null, null);
copy.fabricateTree(size); copy.fabricateTree(size);
Node node = firstNode(); Node node = firstNode();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment