This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Patch: FYI: classpath compare
- From: Tom Tromey <tromey at redhat dot com>
- To: Java Patch List <java-patches at gcc dot gnu dot org>
- Cc: Gcc Patch List <gcc-patches at gcc dot gnu dot org>
- Date: 07 Dec 2001 16:26:40 -0700
- Subject: Patch: FYI: classpath compare
- Reply-to: tromey at redhat dot com
I'm checking this in. It's another comparison against Classpath.
Tom
Index: ChangeLog
from Tom Tromey <tromey@redhat.com>
* libgcj-classpath-compare.html: Rebuilt.
Index: libgcj-classpath-compare.html
===================================================================
RCS file: /cvs/gcc/wwwdocs/htdocs/java/libgcj-classpath-compare.html,v
retrieving revision 1.21
diff -u -r1.21 libgcj-classpath-compare.html
--- libgcj-classpath-compare.html 2001/11/14 23:40:13 1.21
+++ libgcj-classpath-compare.html 2001/12/07 23:21:43
@@ -9,7 +9,7 @@
cvs Classpath. It was generated using the <a
href="scripts/gen-classpath-compare"><code>gen-classpath-compare</code></a>
script on
-2001-11-14.
+2001-12-07.
This table intentionally omits certain classes which are not of
interest. If the third column shows a "Diff" link, then that means
the script believes that the class has been merged, but a difference
@@ -36,6 +36,7 @@
<tr> <td>java.lang.Character</td> <td>Yes</td> <td>Yes</td> <td bgcolor="#eeeeaa">No</td> </tr>
<tr> <td>java.lang.Class</td> <td>Yes</td> <td bgcolor="#eeeeaa">No</td> <td bgcolor="#eeeeaa">No</td> </tr>
<tr> <td>java.lang.ClassLoader</td> <td>Yes</td> <td>Yes</td> <td bgcolor="#eeeeaa">No</td> </tr>
+<tr> <td>java.lang.Double</td> <td>Yes</td> <td>Yes</td> <td bgcolor="#aaaaee"><a href="compare/java.lang.Double.diff">Diff</a></td> </tr>
<tr> <td>java.lang.EcosProcess</td> <td>Yes</td> <td bgcolor="#eeeeaa">No</td> <td bgcolor="#eeeeaa">No</td> </tr>
<tr> <td>java.lang.Math</td> <td>Yes</td> <td>Yes</td> <td bgcolor="#eeeeaa">No</td> </tr>
<tr> <td>java.lang.Object</td> <td>Yes</td> <td>Yes</td> <td bgcolor="#eeeeaa">No</td> </tr>
Index: compare/java.util.AbstractCollection.diff
===================================================================
RCS file: /cvs/gcc/wwwdocs/htdocs/java/compare/java.util.AbstractCollection.diff,v
retrieving revision 1.1
diff -u -r1.1 java.util.AbstractCollection.diff
--- compare/java.util.AbstractCollection.diff 2001/11/07 01:23:48 1.1
+++ compare/java.util.AbstractCollection.diff 2001/12/07 23:21:45
@@ -1,4 +1,4 @@
---- /home/tromey/gnu/egcs/classpath/classpath/java/util/AbstractCollection.java Fri Oct 26 16:06:56 2001
+--- /home/tromey/gnu/egcs/classpath/classpath/java/util/AbstractCollection.java Sun Nov 25 12:30:06 2001
+++ java/util/AbstractCollection.java Tue Oct 16 09:14:34 2001
@@ -1,5 +1,5 @@
/* AbstractCollection.java -- Abstract implementation of most of Collection
@@ -7,7 +7,7 @@
This file is part of GNU Classpath.
-@@ -42,118 +42,77 @@
+@@ -42,119 +42,77 @@
* backing data structure allows for a more efficient implementation. The
* precise implementation used by AbstractCollection is documented, so that
* subclasses can tell which methods could be implemented more efficiently.
@@ -18,6 +18,7 @@
- * Unfortunately, there is no way to enforce this in Java.
- *
- * @author Original author unknown
+- * @author Bryce McKinlay
- * @author Eric Blake <ebb9@email.byu.edu>
- * @see Collection
- * @see AbstractSet
@@ -111,7 +112,7 @@
Iterator itr = c.iterator();
+ int size = c.size();
boolean modified = false;
-- int pos = size();
+- int pos = c.size();
- while (--pos >= 0)
- modified |= add(itr.next());
+ for (int pos = 0; pos < size; pos++)
@@ -154,7 +155,7 @@
}
}
-@@ -171,10 +130,12 @@
+@@ -172,10 +130,12 @@
public boolean contains(Object o)
{
Iterator itr = iterator();
@@ -171,7 +172,7 @@
return false;
}
-@@ -186,17 +147,17 @@
+@@ -187,17 +147,17 @@
*
* @param c the collection to test against
* @return true if this collection contains all the elements in the given
@@ -183,7 +184,7 @@
public boolean containsAll(Collection c)
{
Iterator itr = c.iterator();
-- int pos = size();
+- int pos = c.size();
- while (--pos >= 0)
- if (!contains(itr.next()))
- return false;
@@ -196,7 +197,7 @@
return true;
}
-@@ -205,7 +166,6 @@
+@@ -206,7 +166,6 @@
* size() == 0.
*
* @return true if this collection is empty.
@@ -204,7 +205,7 @@
*/
public boolean isEmpty()
{
-@@ -213,131 +173,92 @@
+@@ -214,131 +173,92 @@
}
/**
@@ -387,7 +388,7 @@
return modified;
}
-@@ -345,18 +266,18 @@
+@@ -346,18 +266,18 @@
* Return an array containing the elements of this collection. This
* implementation creates an Object array of size size() and then iterates
* over the collection, setting each element of the array from the value
@@ -412,7 +413,7 @@
return a;
}
-@@ -372,29 +293,29 @@
+@@ -373,29 +293,29 @@
* obtained over the collection and the elements are placed in the array as
* they are returned by the iterator. Finally the first spare element, if
* any, of the array is set to null, and the created array is returned.
@@ -456,7 +457,7 @@
return a;
}
-@@ -410,41 +331,15 @@
+@@ -411,41 +331,15 @@
public String toString()
{
Iterator itr = iterator();
Index: compare/java.util.AbstractList.diff
===================================================================
RCS file: /cvs/gcc/wwwdocs/htdocs/java/compare/java.util.AbstractList.diff,v
retrieving revision 1.1
diff -u -r1.1 java.util.AbstractList.diff
--- compare/java.util.AbstractList.diff 2001/11/07 01:23:48 1.1
+++ compare/java.util.AbstractList.diff 2001/12/07 23:21:46
@@ -1,4 +1,4 @@
---- /home/tromey/gnu/egcs/classpath/classpath/java/util/AbstractList.java Fri Oct 26 16:06:56 2001
+--- /home/tromey/gnu/egcs/classpath/classpath/java/util/AbstractList.java Sun Nov 25 12:30:06 2001
+++ java/util/AbstractList.java Tue Oct 16 09:14:34 2001
@@ -1,5 +1,5 @@
/* AbstractList.java -- Abstract implementation of most of List
@@ -7,7 +7,7 @@
This file is part of GNU Classpath.
-@@ -25,191 +25,67 @@
+@@ -25,192 +25,67 @@
executable file might be covered by the GNU General Public License. */
@@ -37,6 +37,7 @@
- * synchronized.
- *
- * @author Original author unknown
+- * @author Bryce McKinlay
- * @author Eric Blake <ebb9@email.byu.edu>
- * @see Collection
- * @see List
@@ -221,7 +222,7 @@
return false;
int size = size();
if (size != ((List) o).size())
-@@ -218,272 +94,77 @@
+@@ -219,272 +94,77 @@
Iterator itr1 = iterator();
Iterator itr2 = ((List) o).iterator();
@@ -335,8 +336,8 @@
- checkMod();
- if (pos == size)
- throw new NoSuchElementException();
-- last = pos++;
-- return get(pos);
+- last = pos;
+- return get(pos++);
- }
-
- public void remove()
@@ -450,8 +451,8 @@
- checkMod();
- if (position == size)
- throw new NoSuchElementException();
-- lastReturned = position++;
-- return get(lastReturned);
+- lastReturned = position;
+- return get(position++);
- }
-
- public Object previous()
@@ -526,7 +527,7 @@
public Object remove(int index)
{
throw new UnsupportedOperationException();
-@@ -494,10 +175,8 @@
+@@ -495,10 +175,8 @@
* removeRange methods of the class which implements subList, which are
* difficult for subclasses to override directly. Therefore, this method
* should be overridden instead by the more efficient implementation, if one
@@ -538,7 +539,7 @@
* This implementation first checks for illegal or out of range arguments. It
* then obtains a ListIterator over the list using listIterator(fromIndex).
* It then calls next() and remove() on this iterator repeatedly, toIndex -
-@@ -511,131 +190,152 @@
+@@ -512,131 +190,152 @@
ListIterator itr = listIterator(fromIndex);
for (int index = fromIndex; index < toIndex; index++)
{
@@ -782,7 +783,7 @@
private void checkMod()
{
if (modCount != backingList.modCount)
-@@ -645,64 +345,45 @@
+@@ -646,64 +345,45 @@
/**
* This method checks that a value is between 0 and size (inclusive). If
* it is not, an exception is thrown.
@@ -857,7 +858,7 @@
public Object get(int index)
{
checkMod();
-@@ -710,109 +391,62 @@
+@@ -711,109 +391,62 @@
return backingList.get(index + offset);
}
@@ -980,7 +981,7 @@
public boolean hasNext()
{
-@@ -828,36 +462,44 @@
+@@ -829,36 +462,44 @@
public Object next()
{
@@ -1034,7 +1035,7 @@
}
public void set(Object o)
-@@ -868,14 +510,14 @@
+@@ -869,14 +510,14 @@
public void add(Object o)
{
i.add(o);
@@ -1051,7 +1052,7 @@
// Using any other method on this list will call a corresponding
// method on the backing list *after* the backing listIterator
// is created, which will in turn cause a ConcurrentModException
-@@ -888,31 +530,9 @@
+@@ -889,31 +530,9 @@
// only, but somewhat pointless when the list can be changed under
// us.
// Either way, no explicit handling of modCount is needed.
Index: compare/java.util.AbstractSet.diff
===================================================================
RCS file: /cvs/gcc/wwwdocs/htdocs/java/compare/java.util.AbstractSet.diff,v
retrieving revision 1.1
diff -u -r1.1 java.util.AbstractSet.diff
--- compare/java.util.AbstractSet.diff 2001/11/07 01:23:48 1.1
+++ compare/java.util.AbstractSet.diff 2001/12/07 23:21:46
@@ -1,4 +1,4 @@
---- /home/tromey/gnu/egcs/classpath/classpath/java/util/AbstractSet.java Fri Oct 19 18:43:44 2001
+--- /home/tromey/gnu/egcs/classpath/classpath/java/util/AbstractSet.java Sun Nov 25 12:30:06 2001
+++ java/util/AbstractSet.java Tue Oct 16 09:14:34 2001
@@ -1,5 +1,5 @@
/* AbstractSet.java -- Abstract implementation of most of Set
@@ -52,7 +52,7 @@
}
/**
-@@ -84,43 +69,14 @@
+@@ -84,45 +69,14 @@
public int hashCode()
{
Iterator itr = iterator();
@@ -61,14 +61,8 @@
- int pos = size();
- while (--pos >= 0)
- hash += hashCode(itr.next());
-+ for (int pos = 0; pos < size; pos++)
-+ {
-+ Object obj = itr.next();
-+ if (obj != null)
-+ hash += obj.hashCode();
-+ }
- return hash;
- }
+- return hash;
+- }
-
- /**
- * Removes from this set all elements in the given collection (optional
@@ -93,13 +87,20 @@
- int count = c.size();
- Iterator i;
- if (oldsize < count)
-- for (i = iterator(), count = oldsize; count > 0; count--)
-- if (c.contains(i.next()))
-- i.remove();
++ for (int pos = 0; pos < size; pos++)
+ {
+- for (i = iterator(), count = oldsize; count > 0; count--)
+- if (c.contains(i.next()))
+- i.remove();
++ Object obj = itr.next();
++ if (obj != null)
++ hash += obj.hashCode();
+ }
- else
- for (i = c.iterator(); count > 0; count--)
- remove(i.next());
- return oldsize != size();
-- }
++ return hash;
+ }
-
}
Index: compare/java.util.HashMap.diff
===================================================================
RCS file: /cvs/gcc/wwwdocs/htdocs/java/compare/java.util.HashMap.diff,v
retrieving revision 1.5
diff -u -r1.5 java.util.HashMap.diff
--- compare/java.util.HashMap.diff 2001/11/07 01:23:49 1.5
+++ compare/java.util.HashMap.diff 2001/12/07 23:21:46
@@ -1,4 +1,4 @@
---- /home/tromey/gnu/egcs/classpath/classpath/java/util/HashMap.java Fri Oct 26 16:06:57 2001
+--- /home/tromey/gnu/egcs/classpath/classpath/java/util/HashMap.java Sun Nov 25 12:30:06 2001
+++ java/util/HashMap.java Fri Nov 2 21:44:52 2001
@@ -53,16 +53,14 @@
* <p>
@@ -424,15 +424,16 @@
}
/**
-@@ -464,7 +463,6 @@
+@@ -464,8 +463,6 @@
}
copy.buckets = new HashEntry[buckets.length];
copy.putAllInternal(this);
+- // Clear the entry cache. AbstractMap.clone() does the others.
- copy.entries = null;
return copy;
}
-@@ -479,43 +477,41 @@
+@@ -480,43 +477,41 @@
*/
public Set keySet()
{
@@ -511,7 +512,7 @@
}
/**
-@@ -530,34 +526,33 @@
+@@ -531,34 +526,33 @@
*/
public Collection values()
{
@@ -568,7 +569,7 @@
*
* Note that the iterators for all three views, from keySet(), entrySet(),
* and values(), traverse the HashMap in the same sequence.
-@@ -569,62 +564,53 @@
+@@ -570,62 +564,53 @@
*/
public Set entrySet()
{
@@ -673,7 +674,7 @@
}
/**
-@@ -652,50 +638,6 @@
+@@ -653,52 +638,6 @@
}
/**
@@ -710,8 +711,10 @@
- void putAllInternal(Map m)
- {
- Iterator itr = m.entrySet().iterator();
+- int msize = m.size();
+- this.size = msize;
-
-- for (int msize = m.size(); msize > 0; msize--)
+- for (; msize > 0; msize--)
- {
- Map.Entry e = (Map.Entry) itr.next();
- Object key = e.getKey();
@@ -724,7 +727,7 @@
* Increases the size of the HashMap and rehashes all keys to new array
* indices; this is called when the addition of a new value would cause
* size() > threshold. Note that the existing Entry objects are reused in
-@@ -740,6 +682,35 @@
+@@ -743,6 +682,35 @@
}
/**
@@ -760,7 +763,7 @@
* Serializes this object to the given stream.
*
* @param s the stream to write to
-@@ -786,6 +757,9 @@
+@@ -789,6 +757,9 @@
// Read and use capacity.
buckets = new HashEntry[s.readInt()];
int len = s.readInt();
@@ -770,7 +773,7 @@
// Read and use key/value pairs.
for ( ; len > 0; len--)
-@@ -799,29 +773,29 @@
+@@ -802,29 +773,29 @@
*
* @author Jon Zeppieri
*/
@@ -807,7 +810,7 @@
/**
* Construct a new HashIterator with the supplied type.
-@@ -866,14 +840,14 @@
+@@ -869,14 +840,14 @@
last = e;
if (type == VALUES)
return e.value;
@@ -824,7 +827,7 @@
* @throws ConcurrentModificationException if the HashMap was modified
* @throws IllegalStateException if called when there is no last element
*/
-@@ -885,8 +859,8 @@
+@@ -888,8 +859,8 @@
throw new IllegalStateException();
HashMap.this.remove(last.key);
Index: compare/java.util.Hashtable.diff
===================================================================
RCS file: /cvs/gcc/wwwdocs/htdocs/java/compare/java.util.Hashtable.diff,v
retrieving revision 1.6
diff -u -r1.6 java.util.Hashtable.diff
--- compare/java.util.Hashtable.diff 2001/11/07 01:23:49 1.6
+++ compare/java.util.Hashtable.diff 2001/12/07 23:21:47
@@ -1,4 +1,4 @@
---- /home/tromey/gnu/egcs/classpath/classpath/java/util/Hashtable.java Fri Oct 26 16:06:57 2001
+--- /home/tromey/gnu/egcs/classpath/classpath/java/util/Hashtable.java Sun Nov 25 12:30:06 2001
+++ java/util/Hashtable.java Tue Oct 16 15:18:25 2001
@@ -66,9 +66,7 @@
* Unlike HashMap, Hashtable does not accept `null' as a key value. Also,
@@ -103,7 +103,15 @@
{
if (newVal == null)
throw new NullPointerException();
-@@ -227,8 +200,8 @@
+@@ -220,15 +193,15 @@
+ public Hashtable(Map m)
+ {
+ this(Math.max(m.size() * 2, DEFAULT_CAPACITY), DEFAULT_LOAD_FACTOR);
+- putAllInternal(m);
++ putAll(m);
+ }
+
+ /**
* Construct a new Hashtable with a specific inital capacity and
* default load factor of 0.75.
*
@@ -316,7 +324,7 @@
// This is impossible.
}
copy.buckets = new HashEntry[buckets.length];
-- copy.putAll(this);
+- copy.putAllInternal(this);
- // Clear the caches.
- copy.keys = null;
- copy.values = null;
@@ -511,14 +519,14 @@
+ public void clear()
+ {
+ Hashtable.this.clear();
-+ }
+ }
+- return values;
+
+ // Override this so that we check for null
+ public boolean contains(Object o)
+ {
+ return Hashtable.this.contains(o);
- }
-- return values;
++ }
+ };
+
+ // We must specify the correct object to synchronize upon, hence the
@@ -654,11 +662,11 @@
private HashEntry getEntry(Object o)
{
- if (! (o instanceof Map.Entry))
-+ if (!(o instanceof Map.Entry))
- return null;
+- return null;
- Object key = ((Map.Entry) o).getKey();
- if (key == null)
-- return null;
++ if (!(o instanceof Map.Entry))
+ return null;
-
- int idx = hash(key);
+ Map.Entry me = (Map.Entry) o;
@@ -671,7 +679,38 @@
return e;
e = e.next;
}
-@@ -845,8 +813,7 @@
+@@ -838,30 +806,6 @@
+ }
+
+ /**
+- * A simplified, more efficient internal implementation of putAll(). The
+- * Map constructor and clone() should not call putAll or put, in order to
+- * be compatible with the JDK implementation with respect to subclasses.
+- *
+- * @param m the map to initialize this from
+- */
+- void putAllInternal(Map m)
+- {
+- Iterator itr = m.entrySet().iterator();
+- int msize = m.size();
+- this.size = msize;
+-
+- for (; msize > 0; msize--)
+- {
+- Map.Entry e = (Map.Entry) itr.next();
+- Object key = e.getKey();
+- int idx = hash(key);
+- HashEntry he = new HashEntry(key, e.getValue());
+- he.next = buckets[idx];
+- buckets[idx] = he;
+- }
+- }
+-
+- /**
+ * Increases the size of the Hashtable and rehashes all keys to new array
+ * indices; this is called when the addition of a new value would cause
+ * size() > threshold. Note that the existing Entry objects are reused in
+@@ -869,8 +813,7 @@
* <p>
*
* This is not specified, but the new size is twice the current size plus
@@ -681,7 +720,7 @@
*/
protected void rehash()
{
-@@ -887,8 +854,8 @@
+@@ -911,8 +854,8 @@
*
* @param s the stream to write to
* @throws IOException if the underlying stream fails
@@ -692,7 +731,7 @@
* are emitted first. They are followed by size entries,
* each consisting of a key (Object) and a value (Object).
*/
-@@ -903,7 +870,7 @@
+@@ -927,7 +870,7 @@
// Since we are already synchronized, and entrySet().iterator()
// would repeatedly re-lock/release the monitor, we directly use the
// unsynchronized HashIterator instead.
@@ -701,7 +740,7 @@
while (it.hasNext())
{
HashEntry entry = (HashEntry) it.next();
-@@ -918,8 +885,8 @@
+@@ -942,8 +885,8 @@
* @param s the stream to read from
* @throws ClassNotFoundException if the underlying stream fails
* @throws IOException if the underlying stream fails
@@ -712,7 +751,7 @@
* are emitted first. They are followed by size entries,
* each consisting of a key (Object) and a value (Object).
*/
-@@ -934,8 +901,7 @@
+@@ -958,8 +901,7 @@
int len = s.readInt();
// Read and use key/value pairs.
@@ -722,7 +761,7 @@
put(s.readObject(), s.readObject());
}
-@@ -950,8 +916,13 @@
+@@ -974,8 +916,13 @@
*
* @author Jon Zeppieri
*/
@@ -737,7 +776,7 @@
/**
* The type of this Iterator: {@link #KEYS}, {@link #VALUES},
* or {@link #ENTRIES}.
-@@ -1017,14 +988,14 @@
+@@ -1041,14 +988,14 @@
last = e;
if (type == VALUES)
return e.value;
@@ -754,7 +793,7 @@
* @throws ConcurrentModificationException if the hashtable was modified
* @throws IllegalStateException if called when there is no last element
*/
-@@ -1036,10 +1007,10 @@
+@@ -1060,10 +1007,10 @@
throw new IllegalStateException();
Hashtable.this.remove(last.key);
@@ -767,7 +806,7 @@
/**
-@@ -1056,21 +1027,21 @@
+@@ -1080,21 +1027,21 @@
*
* @author Jon Zeppieri
*/
@@ -799,7 +838,7 @@
HashEntry next;
/**
-@@ -1080,6 +1051,25 @@
+@@ -1104,6 +1051,25 @@
Enumerator(int type)
{
this.type = type;
@@ -825,7 +864,7 @@
}
/**
-@@ -1088,7 +1078,10 @@
+@@ -1112,7 +1078,10 @@
*/
public boolean hasMoreElements()
{
@@ -837,7 +876,7 @@
}
/**
-@@ -1098,16 +1091,19 @@
+@@ -1122,16 +1091,19 @@
*/
public Object nextElement()
{
Index: compare/java.util.LinkedList.diff
===================================================================
RCS file: /cvs/gcc/wwwdocs/htdocs/java/compare/java.util.LinkedList.diff,v
retrieving revision 1.1
diff -u -r1.1 java.util.LinkedList.diff
--- compare/java.util.LinkedList.diff 2001/11/07 01:23:49 1.1
+++ compare/java.util.LinkedList.diff 2001/12/07 23:21:48
@@ -1,4 +1,4 @@
---- /home/tromey/gnu/egcs/classpath/classpath/java/util/LinkedList.java Fri Oct 26 16:06:57 2001
+--- /home/tromey/gnu/egcs/classpath/classpath/java/util/LinkedList.java Sun Nov 25 12:30:06 2001
+++ java/util/LinkedList.java Tue Oct 16 09:14:34 2001
@@ -1,5 +1,5 @@
/* LinkedList.java -- Linked list implementation of the List interface
@@ -7,7 +7,7 @@
This file is part of GNU Classpath.
-@@ -32,49 +32,25 @@
+@@ -32,50 +32,25 @@
import java.io.IOException;
import java.lang.reflect.Array;
@@ -35,6 +35,7 @@
- * non-deterministic behavior.
- *
- * @author Original author unknown
+- * @author Bryce McKinlay
- * @author Eric Blake <ebb9@email.byu.edu>
- * @see List
- * @see ArrayList
@@ -67,7 +68,7 @@
transient Entry last;
/**
-@@ -85,27 +61,18 @@
+@@ -86,27 +61,18 @@
/**
* Class to represent an entry in the list. Holds a single element.
*/
@@ -99,7 +100,7 @@
/**
* Obtain the Entry at a given position in a list. This method of course
* takes linear time, but it is intelligent enough to take the shorter of the
-@@ -115,8 +82,7 @@
+@@ -116,8 +82,7 @@
* For speed and flexibility, range checking is not done in this method:
* Incorrect values will be returned if (n < 0) or (n >= size).
*
@@ -109,7 +110,7 @@
*/
private Entry getEntry(int n)
{
-@@ -124,76 +90,50 @@
+@@ -125,76 +90,50 @@
if (n < size / 2)
{
e = first;
@@ -218,7 +219,7 @@
}
/**
-@@ -201,26 +141,24 @@
+@@ -202,26 +141,24 @@
*/
public LinkedList()
{
@@ -251,7 +252,7 @@
public Object getFirst()
{
if (size == 0)
-@@ -228,12 +166,6 @@
+@@ -229,12 +166,6 @@
return first.data;
}
@@ -264,7 +265,7 @@
public Object getLast()
{
if (size == 0)
-@@ -241,374 +173,273 @@
+@@ -242,374 +173,273 @@
return last.data;
}
@@ -333,11 +334,9 @@
- Entry e = new Entry(o);
-
modCount++;
-- size++;
-- if (size == 1)
+ Entry e = new Entry(o);
+
-+ if (size == 0)
+ if (size == 0)
first = last = e;
else
{
@@ -348,7 +347,7 @@
- }
+ first = e;
+ }
-+ size++;
+ size++;
}
- /**
@@ -371,7 +370,6 @@
private void addLastEntry(Entry e)
{
- modCount++;
-- size++;
if (size == 0)
first = last = e;
else
@@ -382,7 +380,7 @@
- last = e;
+ last = e;
}
-+ size++;
+ size++;
}
- /**
@@ -642,7 +640,6 @@
if (index < size)
{
- modCount++;
-- size++;
- Entry after = getEntry(index);
- e.next = after;
- e.previous = after.previous;
@@ -651,6 +648,7 @@
- else
- after.previous.next = e;
- after.previous = e;
+- size++;
+ Entry after = getEntry(index);
+ e.next = after;
+ e.previous = after.previous;
@@ -735,7 +733,7 @@
}
/**
-@@ -617,27 +448,28 @@
+@@ -618,27 +448,28 @@
* methods.
*
* @param index the index of the element to be returned by the first call to
@@ -771,7 +769,7 @@
}
catch (CloneNotSupportedException ex)
{
-@@ -646,12 +478,7 @@
+@@ -647,12 +478,7 @@
copy.addAll(this);
return copy;
}
@@ -785,7 +783,7 @@
public Object[] toArray()
{
Object[] array = new Object[size];
-@@ -663,285 +490,182 @@
+@@ -664,282 +490,182 @@
}
return array;
}
@@ -895,15 +893,15 @@
-
- /** Entry that will be returned by next(). */
- private Entry next;
+-
+- /** Entry that will be returned by previous(). */
+- private Entry previous;
+ int knownMod;
+ Entry next; // entry that will be returned by next().
+ Entry previous; // entry that will be returned by previous().
+ Entry lastReturned; // entry that will be affected by remove() or set().
+ int position; // index of `next'.
-- /** Entry that will be returned by previous(). */
-- private Entry previous;
--
- /** Entry that will be affected by remove() or set(). */
- private Entry lastReturned;
-
@@ -1088,10 +1086,8 @@
+ first = e;
if (next != null)
- {
-- next.previous = e;
-- next = next.next;
-- }
+- next.previous = e;
++ {
+ next.previous = e;
+ next = next.next;
+ }
Index: compare/java.util.TreeMap.diff
===================================================================
RCS file: /cvs/gcc/wwwdocs/htdocs/java/compare/java.util.TreeMap.diff,v
retrieving revision 1.1
diff -u -r1.1 java.util.TreeMap.diff
--- compare/java.util.TreeMap.diff 2001/11/07 01:23:49 1.1
+++ compare/java.util.TreeMap.diff 2001/12/07 23:21:49
@@ -1,4 +1,4 @@
---- /home/tromey/gnu/egcs/classpath/classpath/java/util/TreeMap.java Fri Oct 26 16:06:59 2001
+--- /home/tromey/gnu/egcs/classpath/classpath/java/util/TreeMap.java Sun Nov 25 12:30:06 2001
+++ java/util/TreeMap.java Tue Oct 16 09:14:35 2001
@@ -38,166 +38,80 @@
* interface. Elements in the Map will be sorted by either a user-provided
@@ -1731,9 +1731,9 @@
+ Node parent = node.parent;
+ while (parent != nil && node == parent.right)
{
-- // Node to be deleted has 0 children.
+- // Node to be deleted has 1 child.
- splice = node;
-- child = nil;
+- child = node.left;
+ node = parent;
+ parent = parent.parent;
}