Hi,

I removed the RCS keywords from some files to make it easier to see if files
in the Classpath and libgcj CVS trees are actually the same.
I merged some of the easier classes from java.util.
And I removed java.util.DoubleEnumeration because there is a newer version
in gnu.java.util.

2001-02-18  Mark Wielaard <[EMAIL PROTECTED]>

    * java/util/ArrayList.java: Remove RCS keywords from comments
    * java/util/BasicMapEntry.java: idem
    * java/util/Dictionary.java: idem
    * java/util/HashMap.java: idem
    * java/util/HashSet.java: idem
    * java/util/Hashtable.java: idem
    * java/util/TreeMap.java: idem
    * java/util/TreeSet.java: idem

    * java/util/Collection.java: reindent

    * java/util/ConcurrentModificationException.java: merge with libgcj
    * java/util/EmptyStackException.java: idem
    * java/util/Enumeration.java: idem
    * java/util/EventListener.java: idem
    * java/util/MissingResourceException.java: idem
    * java/util/NoSuchElementException.java: idem
    * java/util/Observable.java: idem
    * java/util/Observer.java: idem
    * java/util/Stack.java: idem
    * java/util/TooManyListenersException.java: idem

    * java/util/DoubleEnumeration.java: removed
    * java/util/PropertyResourceBundle.java:
    import gnu.java.util.DoubleEnumeration

If I get the changes also in the libgcj tree then only the following classes
from java.util need merging:

java/util/Calendar.java
java/util/Date.java
java/util/GregorianCalendar.java
java/util/ListResourceBundle.java
java/util/Locale.java
java/util/PropertyResourceBundle.java
java/util/Random.java
java/util/ResourceBundle.java
java/util/StringTokenizer.java
java/util/TimeZone.java

Cheers,

Mark

-- 
Stuff to read:
    <http://www.toad.com/gnu/whatswrong.html>
  What's Wrong with Copy Protection, by John Gilmore
Index: java/util/ArrayList.java
===================================================================
RCS file: /cvs/classpath/java/util/ArrayList.java,v
retrieving revision 1.14
diff -u -u -r1.14 ArrayList.java
--- java/util/ArrayList.java    2001/02/15 06:26:31     1.14
+++ java/util/ArrayList.java    2001/02/18 15:31:04
@@ -40,7 +40,6 @@
  * to or removing from the end of a list, checking the size, &c.
  *
  * @author        Jon A. Zeppieri
- * @version       $Id: ArrayList.java,v 1.14 2001/02/15 06:26:31 bryce Exp $
  * @see           java.util.AbstractList
  * @see           java.util.List
  */
Index: java/util/BasicMapEntry.java
===================================================================
RCS file: /cvs/classpath/java/util/BasicMapEntry.java,v
retrieving revision 1.6
diff -u -u -r1.6 BasicMapEntry.java
--- java/util/BasicMapEntry.java        2001/02/15 06:26:31     1.6
+++ java/util/BasicMapEntry.java        2001/02/18 15:31:04
@@ -33,8 +33,6 @@
  * Hashtable.
  *
  * @author      Jon Zeppieri
- * @version     $Revision: 1.6 $
- * @modified    $Id: BasicMapEntry.java,v 1.6 2001/02/15 06:26:31 bryce Exp $
  */
 class BasicMapEntry implements Map.Entry
 {
Index: java/util/Collection.java
===================================================================
RCS file: /cvs/classpath/java/util/Collection.java,v
retrieving revision 1.5
diff -u -u -r1.5 Collection.java
--- java/util/Collection.java   2000/10/26 10:19:00     1.5
+++ java/util/Collection.java   2001/02/18 15:31:04
@@ -213,7 +213,7 @@
    *   collection, containing the elements currently in this collection, in
    *   any order.
    */
-  Object[]toArray();
+  Object[] toArray();
 
   /**
    * Copy the current contents of this collection into an array. If the array
@@ -232,5 +232,5 @@
    * @exception ArrayStoreException if the type of any element of the
    *   collection is not a subtype of the element type of a.
    */
-  Object[]toArray(Object[]a);
+  Object[] toArray(Object[] a);
 }
Index: java/util/ConcurrentModificationException.java
===================================================================
RCS file: /cvs/classpath/java/util/ConcurrentModificationException.java,v
retrieving revision 1.5
diff -u -u -r1.5 ConcurrentModificationException.java
--- java/util/ConcurrentModificationException.java      2000/10/26 10:19:00     1.5
+++ java/util/ConcurrentModificationException.java      2001/02/18 15:31:04
@@ -1,5 +1,5 @@
 /* ConcurrentModificationException.java -- Data structure concurrently modified
-   Copyright (C) 1998, 1999 Free Software Foundation, Inc.
+   Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -27,6 +27,12 @@
 
 package java.util;
 
+/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
+ * "The Java Language Specification", ISBN 0-201-63451-1
+ * plus online API docs for JDK 1.2 beta from http://www.javasoft.com.
+ * Status:  Believed complete and correct.
+ */
+
 /**
  * Exception that is thrown by the collections classes when it is detected that
  * a modification has been made to a data structure when this is not allowed,
@@ -34,6 +40,10 @@
  * operating over it. In cases where this can be detected, a
  * ConcurrentModificationException will be thrown. An Iterator that detects this
  * condition is referred to as fail-fast.
+ *
+ * @author Warren Levy <[EMAIL PROTECTED]>
+ * @date September 2, 1998.
+ * @since 1.2
  */
 public class ConcurrentModificationException extends RuntimeException
 {
Index: java/util/Dictionary.java
===================================================================
RCS file: /cvs/classpath/java/util/Dictionary.java,v
retrieving revision 1.4
diff -u -u -r1.4 Dictionary.java
--- java/util/Dictionary.java   2000/10/26 10:19:00     1.4
+++ java/util/Dictionary.java   2001/02/18 15:31:04
@@ -40,8 +40,6 @@
  * in the Collections framework.
  *
  * @author      Jon Zeppieri
- * @version     $Revision: 1.4 $
- * @modified    $Id: Dictionary.java,v 1.4 2000/10/26 10:19:00 bryce Exp $
  */
 public abstract class Dictionary extends Object
 {
Index: java/util/EmptyStackException.java
===================================================================
RCS file: /cvs/classpath/java/util/EmptyStackException.java,v
retrieving revision 1.5
diff -u -u -r1.5 EmptyStackException.java
--- java/util/EmptyStackException.java  2000/10/26 10:19:00     1.5
+++ java/util/EmptyStackException.java  2001/02/18 15:31:04
@@ -1,5 +1,5 @@
 /* EmptyStackException.java -- Attempt to pop from an empty stack
-   Copyright (C) 1998, 1999 Free Software Foundation, Inc.
+   Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -27,9 +27,18 @@
 
 package java.util;
 
+/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
+ * "The Java Language Specification", ISBN 0-201-63451-1
+ * plus online API docs for JDK 1.2 beta from http://www.javasoft.com.
+ * Status:  Believed complete and correct.
+ */
+
 /**
  * This exception is thrown by the Stack class when an attempt is made to pop
  * or otherwise access elements from an empty stack.
+ *
+ * @author Warren Levy <[EMAIL PROTECTED]>
+ * @date September 2, 1998.
  */
 public class EmptyStackException extends RuntimeException
 {
Index: java/util/Enumeration.java
===================================================================
RCS file: /cvs/classpath/java/util/Enumeration.java,v
retrieving revision 1.4
diff -u -u -r1.4 Enumeration.java
--- java/util/Enumeration.java  2000/10/26 10:19:00     1.4
+++ java/util/Enumeration.java  2001/02/18 15:31:04
@@ -1,5 +1,5 @@
 /* Enumeration.java -- Interface for enumerating lists of objects
-   Copyright (C) 1998 Free Software Foundation, Inc.
+   Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -24,18 +24,25 @@
 This exception does not however invalidate any other reasons why the
 executable file might be covered by the GNU General Public License. */
 
-
 package java.util;
 
+/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
+ * "The Java Language Specification", ISBN 0-201-63451-1.
+ * Status:  Believed complete and correct
+ */
+
 /**
  * Interface for lists of objects that can be returned in sequence. Successive
  * objects are obtained by the nextElement method.
- * <P>
+ * <p>
  * As of Java 1.2, the Iterator interface provides the same functionality, but
  * with shorter method names and a new optional method to remove items from the
  * list. If writing for 1.2, consider using Iterator instead. Enumerations over
  * the new collections classes, for use with legacy APIs that require them, can
  * be obtained by the enumeration method in class Collections.
+ *
+ * @author Warren Levy <[EMAIL PROTECTED]>
+ * @date August 25, 1998.
  */
 public interface Enumeration
 {
@@ -54,5 +61,5 @@
    * @return the next element in the enumeration
    * @exception NoSuchElementException if there are no more elements
    */
-  Object nextElement();
+  Object nextElement() throws NoSuchElementException;
 }
Index: java/util/EventListener.java
===================================================================
RCS file: /cvs/classpath/java/util/EventListener.java,v
retrieving revision 1.4
diff -u -u -r1.4 EventListener.java
--- java/util/EventListener.java        2000/10/26 10:19:00     1.4
+++ java/util/EventListener.java        2001/02/18 15:31:04
@@ -1,5 +1,5 @@
 /* An interface that all event listener interfaces must extend
-   Copyright (C) 1999 Free Software Foundation, Inc.
+   Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -27,6 +27,21 @@
 
 package java.util;
 
+/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
+ * "The Java Language Specification", ISBN 0-201-63451-1
+ * Status:  Believed complete and correct.
+ */
+
+/**
+ * Empty interface that is implemented by classes that need to receive
+ * events. Subinterfaces define methods that can be called to fire an
+ * event notification. Normally the name of these subinterfaces end in
+ * <code>Listener</code> and all method described by the subinterface
+ * take as argument an subclass of <code>EventObject</code>.
+ *
+ * @author Tom Tromey <[EMAIL PROTECTED]>
+ * @date December 12, 1998
+ */
 public interface EventListener
 {
 }
Index: java/util/HashMap.java
===================================================================
RCS file: /cvs/classpath/java/util/HashMap.java,v
retrieving revision 1.9
diff -u -u -r1.9 HashMap.java
--- java/util/HashMap.java      2001/02/15 06:26:31     1.9
+++ java/util/HashMap.java      2001/02/18 15:31:04
@@ -60,8 +60,6 @@
  * @author         Jon Zeppieri
  * @author         Jochen Hoenicke
  * @author        Bryce McKinlay
- * @version        $Revision: 1.9 $
- * @modified       $Id: HashMap.java,v 1.9 2001/02/15 06:26:31 bryce Exp $
  */
 public class HashMap extends AbstractMap
   implements Map, Cloneable, Serializable
@@ -619,8 +617,6 @@
    * keys, values, or entries.
    *
    * @author       Jon Zeppieri
-   * @version      $Revision: 1.9 $
-   * @modified     $Id: HashMap.java,v 1.9 2001/02/15 06:26:31 bryce Exp $
    */
   class HashIterator implements Iterator
   {
Index: java/util/HashSet.java
===================================================================
RCS file: /cvs/classpath/java/util/HashSet.java,v
retrieving revision 1.7
diff -u -u -r1.7 HashSet.java
--- java/util/HashSet.java      2001/02/16 04:51:24     1.7
+++ java/util/HashSet.java      2001/02/18 15:31:04
@@ -45,8 +45,6 @@
  * HashSet is a part of the JDK1.2 Collections API.
  *
  * @author      Jon Zeppieri
- * @version     $Revision: 1.7 $
- * @modified    $Id: HashSet.java,v 1.7 2001/02/16 04:51:24 bryce Exp $
  */
 public class HashSet extends AbstractSet
   implements Set, Cloneable, Serializable
Index: java/util/Hashtable.java
===================================================================
RCS file: /cvs/classpath/java/util/Hashtable.java,v
retrieving revision 1.10
diff -u -u -r1.10 Hashtable.java
--- java/util/Hashtable.java    2001/02/15 06:26:31     1.10
+++ java/util/Hashtable.java    2001/02/18 15:31:04
@@ -64,8 +64,6 @@
  * @author      Jon Zeppieri
  * @author     Warren Levy
  * @author      Bryce McKinlay
- * @version     $Revision: 1.10 $
- * @modified    $Id: Hashtable.java,v 1.10 2001/02/15 06:26:31 bryce Exp $
  */
 public class Hashtable extends Dictionary 
   implements Map, Cloneable, Serializable
@@ -721,8 +719,6 @@
    * as per the Javasoft spec.
    *
    * @author       Jon Zeppieri
-   * @version      $Revision: 1.10 $
-   * @modified     $Id: Hashtable.java,v 1.10 2001/02/15 06:26:31 bryce Exp $
    */
   class HashIterator implements Iterator
   {
@@ -818,16 +814,15 @@
    * elements; this implementation is parameterized to provide access either 
    * to the keys or to the values in the Hashtable.
    *
-   * <b>NOTE: Enumeration is not safe if new elements are put in the table as
-   * this could cause a rehash and we'd completely lose our place.  Even
+   * <b>NOTE</b>: Enumeration is not safe if new elements are put in the table
+   * as this could cause a rehash and we'd completely lose our place.  Even
    * without a rehash, it is undetermined if a new element added would
    * appear in the enumeration.  The spec says nothing about this, but
    * the "Java Class Libraries" book infers that modifications to the
    * hashtable during enumeration causes indeterminate results.  Don't do it!
    *
    * @author       Jon Zeppieri
-   * @version      $Revision: 1.10 $
-   * @modified $Id: Hashtable.java,v 1.10 2001/02/15 06:26:31 bryce Exp $ */
+   */
   class Enumerator implements Enumeration
   {
     static final int KEYS = 0;
Index: java/util/MissingResourceException.java
===================================================================
RCS file: /cvs/classpath/java/util/MissingResourceException.java,v
retrieving revision 1.5
diff -u -u -r1.5 MissingResourceException.java
--- java/util/MissingResourceException.java     2000/10/26 10:19:01     1.5
+++ java/util/MissingResourceException.java     2001/02/18 15:31:04
@@ -1,5 +1,5 @@
 /* java.util.MissingResourceException
-   Copyright (C) 1998, 1999 Free Software Foundation, Inc.
+   Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -27,11 +27,18 @@
 
 package java.util;
 
+/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
+ * "The Java Language Specification", ISBN 0-201-63451-1
+ * plus online API docs for JDK 1.2 beta from http://www.javasoft.com.
+ * Status:  Believed complete and correct.
+ */
+
 /**
  * This exception is thrown when a resource is missing.
  *
  * @see ResourceBundle
  * @author Jochen Hoenicke
+ * @author Warren Levy <[EMAIL PROTECTED]>
  */
 public class MissingResourceException extends RuntimeException
 {
Index: java/util/NoSuchElementException.java
===================================================================
RCS file: /cvs/classpath/java/util/NoSuchElementException.java,v
retrieving revision 1.5
diff -u -u -r1.5 NoSuchElementException.java
--- java/util/NoSuchElementException.java       2000/10/26 10:19:01     1.5
+++ java/util/NoSuchElementException.java       2001/02/18 15:31:04
@@ -1,5 +1,5 @@
 /* NoSuchElementException.java -- Attempt to access element that does not exist
-   Copyright (C) 1998, 1999 Free Software Foundation, Inc.
+   Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -27,11 +27,20 @@
 
 package java.util;
 
+/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
+ * "The Java Language Specification", ISBN 0-201-63451-1
+ * plus online API docs for JDK 1.2 beta from http://www.javasoft.com.
+ * Status:  Believed complete and correct.
+ */
+
 /**
  * Exception thrown when an attempt is made to access an element that does not
  * exist. This exception is thrown by the Enumeration, Iterator and ListIterator
  * classes if the nextElement, next or previous method goes beyond the end of
  * the list of elements that are being accessed.
+ *
+ * @author Warren Levy <[EMAIL PROTECTED]>
+ * @date September 2, 1998.
  */
 public class NoSuchElementException extends RuntimeException
 {
Index: java/util/Observable.java
===================================================================
RCS file: /cvs/classpath/java/util/Observable.java,v
retrieving revision 1.5
diff -u -u -r1.5 Observable.java
--- java/util/Observable.java   2000/10/26 10:19:01     1.5
+++ java/util/Observable.java   2001/02/18 15:31:04
@@ -1,5 +1,5 @@
 /* java.util.Observable
-   Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -27,11 +27,32 @@
 
 package java.util;
 
+/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
+ * "The Java Language Specification", ISBN 0-201-63451-1
+ * plus online API docs for JDK 1.2 beta from http://www.javasoft.com.
+ * Status:  Believed complete and correct.
+ */
+
+/**
+ * @author Warren Levy <[EMAIL PROTECTED]>
+ * @date September 2, 1998.
+ */
 public class Observable
 {
+  /** tracks whether this object has changed */
   private boolean changed;
+
+  /* list of the Observers registered as interested in this Observable */
   private Vector observers;
 
+  /* TBD: This might be better implemented as an Observer[]
+   * but that would mean writing more code rather than making use of
+   * the existing Vector class (this also implies a larger text code
+   * space in resulting executables).  The tradeoff is one of speed
+   * (manipulating the Observer[] directly) vs. size/reuse.  In the future,
+   * we may decide to make the tradeoff and reimplement with an Observer[].
+   */
+
   /**
    * Constructs an Observable with zero Observers.
    */
@@ -42,19 +63,21 @@
   }
 
   /**
-   * Adds an Observer.
+   * Adds an Observer. If the observer was already added this method does
+   * nothing.
    *
    * @param observer Observer to add.
    */
-  public void addObserver(Observer observer)
+  public synchronized void addObserver(Observer observer)
   {
-    observers.add(observer);
+    if (!observers.contains(observer))
+      observers.addElement(observer);
   }
 
   /**
    * Reset this Observable's state to unchanged.
    */
-  protected void clearChanged()
+  protected synchronized void clearChanged()
   {
     changed = false;
   }
@@ -62,7 +85,7 @@
   /**
    * @return Number of Observers for this Observable.
    */
-  public int countObservers()
+  public synchronized int countObservers()
   {
     return observers.size();
   }
@@ -72,15 +95,15 @@
    *
    * @param victim Observer to delete.
    */
-  public void deleteObserver(Observer victim)
+  public synchronized void deleteObserver(Observer victim)
   {
-    observers.remove(victim);
+    observers.removeElement(victim);
   }
 
   /**
    * Deletes all Observers of this Observable.
    */
-  public void deleteObservers()
+  public synchronized void deleteObservers()
   {
     observers.removeAllElements();
   }
@@ -88,14 +111,14 @@
   /**
    * @return Whether or not this Observable has changed.
    */
-  public boolean hasChanged()
+  public synchronized boolean hasChanged()
   {
     return changed;
   }
 
   /**
-   * Tell Observers that this Observable has changed, then
-   * resets state to unchanged.
+   * If the Observable has actually changed then tell all Observers about it,
+   * then resets state to unchanged.
    */
   public void notifyObservers()
   {
@@ -103,6 +126,11 @@
   }
 
   /**
+   * If the Observable has actually changed then tell all Observers about it,
+   * then resets state to unchanged. 
+   * Note that though the order of notification is unspecified in subclasses,
+   * in Observable it is in the order of registration.
+   *
    * @param obj Arguement to Observer's update method.
    */
   public void notifyObservers(Object obj)
@@ -120,7 +148,7 @@
   /**
    * Marks this Observable as having changed.
    */
-  protected void setChanged()
+  protected synchronized void setChanged()
   {
     changed = true;
   }
Index: java/util/Observer.java
===================================================================
RCS file: /cvs/classpath/java/util/Observer.java,v
retrieving revision 1.4
diff -u -u -r1.4 Observer.java
--- java/util/Observer.java     2000/10/26 10:19:01     1.4
+++ java/util/Observer.java     2001/02/18 15:31:05
@@ -1,6 +1,6 @@
 /* Implemented when a class wants to be informed of changes in Observable
    objects.
-   Copyright (C) 1999 Free Software Foundation, Inc.
+   Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -28,7 +28,21 @@
 
 package java.util;
 
-public abstract interface Observer
+/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
+ * "The Java Language Specification", ISBN 0-201-63451-1
+ * plus online API docs for JDK 1.2 beta from http://www.javasoft.com.
+ * Status:  Believed complete and correct
+ */
+
+/**
+ * Interface that is implemented when a class wants to be informed of changes
+ * in Observable objects.
+ *
+ * @see java.util.Observable
+ * @author Warren Levy <[EMAIL PROTECTED]>
+ * @date August 25, 1998.
+ */
+public interface Observer
 {
   public void update(Observable observable, Object arg);
 }
Index: java/util/PropertyResourceBundle.java
===================================================================
RCS file: /cvs/classpath/java/util/PropertyResourceBundle.java,v
retrieving revision 1.6
diff -u -u -r1.6 PropertyResourceBundle.java
--- java/util/PropertyResourceBundle.java       2000/10/26 10:19:01     1.6
+++ java/util/PropertyResourceBundle.java       2001/02/18 15:31:05
@@ -27,6 +27,8 @@
 
 package java.util;
 
+import gnu.java.util.DoubleEnumeration;
+
 /**
  * This class is a concrete <code>ResourceBundle</code> that gets it
  * resources from a property file.  This implies that the resources are
Index: java/util/Stack.java
===================================================================
RCS file: /cvs/classpath/java/util/Stack.java,v
retrieving revision 1.5
diff -u -u -r1.5 Stack.java
--- java/util/Stack.java        2000/10/26 10:19:01     1.5
+++ java/util/Stack.java        2001/02/18 15:31:05
@@ -1,6 +1,6 @@
 /* Stack.java - Class that provides a Last In First Out (LIFO)
    datatype, known more commonly as a Stack
-   Copyright (C) 1998, 1999 Free Software Foundation, Inc.
+   Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -28,15 +28,28 @@
 
 package java.util;
 
+/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
+ * "The Java Language Specification", ISBN 0-201-63451-1
+ * plus online API docs for JDK 1.2 beta from http://www.javasoft.com.
+ * Status:  Believed complete and correct
+ */
+
 /**
  * Stack provides a Last In First Out (LIFO) data type, commonly known
  * as a Stack.  
  *
  * Stack itself extends Vector and provides the additional methods
  * for stack manipulation (push, pop, peek). 
+ *
+ * @author Warren Levy <[EMAIL PROTECTED]>
+ * @date August 20, 1998.
  */
 public class Stack extends Vector
 {
+  // Could use Vector methods internally for the following methods
+  // but have used Vector fields directly for efficiency (i.e. this
+  // often reduces out duplicate bounds checking).
+
   private static final long serialVersionUID = 1224463164541339165L;
 
   /**
@@ -57,6 +70,10 @@
    */
   public Object push(Object item)
   {
+    // When growing the Stack, use the Vector routines in case more
+    // memory is needed.
+    // Note: spec indicates that this method *always* returns obj passed in!
+
     addElement(item);
     return item;
   }
@@ -67,11 +84,16 @@
    *
    * @returns the Object popped from the stack
    */
-  public Object pop()
+  public synchronized Object pop()
   {
-    if (isEmpty())
+    if (elementCount == 0)
       throw new EmptyStackException();
-    return remove(size() - 1);
+
+    Object obj = elementData[--elementCount];
+
+    // Set topmost element to null to assist the gc in cleanup
+    elementData[elementCount] = null;
+    return obj;
   }
 
   /**
@@ -79,11 +101,12 @@
    *
    * @returns the top Object on the stack
    */
-  public Object peek()
+  public synchronized Object peek()
   {
-    if (isEmpty())
+    if (elementCount == 0)
       throw new EmptyStackException();
-    return lastElement();
+
+    return elementData[elementCount - 1];
   }
 
   /**
@@ -93,7 +116,7 @@
    */
   public boolean empty()
   {
-    return isEmpty();
+    return elementCount == 0;
   }
 
   /**
@@ -105,9 +128,12 @@
    * @returns The 1 based depth of the Object, or -1 if the Object 
    * is not on the stack.
    */
-  public int search(Object o)
+  public synchronized int search(Object o)
   {
-    int idx = lastIndexOf(o);
-    return (idx == -1 ? -1 : elementCount - idx);
+    for (int i = elementCount-1; i >=0; --i)
+      if (elementData[i].equals(o))
+        return elementCount - i;
+
+    return -1;
   }
 }
Index: java/util/TooManyListenersException.java
===================================================================
RCS file: /cvs/classpath/java/util/TooManyListenersException.java,v
retrieving revision 1.4
diff -u -u -r1.4 TooManyListenersException.java
--- java/util/TooManyListenersException.java    2000/10/26 10:19:01     1.4
+++ java/util/TooManyListenersException.java    2001/02/18 15:31:05
@@ -1,5 +1,5 @@
 /* java.util.TooManyListenersException
-   Copyright (C) 1999 Free Software Foundation, Inc.
+   Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -27,6 +27,12 @@
 
 package java.util;
 
+/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
+ * "The Java Language Specification", ISBN 0-201-63451-1
+ * plus online API docs for JDK 1.2 beta from http://www.javasoft.com.
+ * Status:  Believed complete and correct.
+ */
+
 /**
  * This exception is part of the java event model.  It is thrown if an
  * event listener is added via the addXyzEventListener method, but the
@@ -36,6 +42,7 @@
  * @see EventListener
  * @see EventObject
  * @author Jochen Hoenicke 
+ * @author Warren Levy <[EMAIL PROTECTED]>
  */
 
 public class TooManyListenersException extends Exception
Index: java/util/TreeMap.java
===================================================================
RCS file: /cvs/classpath/java/util/TreeMap.java,v
retrieving revision 1.11
diff -u -u -r1.11 TreeMap.java
--- java/util/TreeMap.java      2001/02/16 02:26:59     1.11
+++ java/util/TreeMap.java      2001/02/18 15:31:06
@@ -39,7 +39,7 @@
  * Comparator object, or by the natural ordering of the keys.
  *
  * The algorithms are adopted from Corman, Leiserson,
- * and Rivest's <i>Introduction to Algorithms.<i>  In other words,
+ * and Rivest's <i>Introduction to Algorithms.</i>  In other words,
  * I cribbed from the same pseudocode as Sun.  <em>Any similarity
  * between my code and Sun's (if there is any -- I have never looked
  * at Sun's) is a result of this fact.</em>
@@ -56,7 +56,6 @@
  *
  * @author           Jon Zeppieri
  * @author          Bryce McKinlay
- * @modified         $Id: TreeMap.java,v 1.11 2001/02/16 02:26:59 bryce Exp $
  */
 public class TreeMap extends AbstractMap
   implements SortedMap, Cloneable, Serializable
Index: java/util/TreeSet.java
===================================================================
RCS file: /cvs/classpath/java/util/TreeSet.java,v
retrieving revision 1.9
diff -u -u -r1.9 TreeSet.java
--- java/util/TreeSet.java      2001/02/16 02:04:23     1.9
+++ java/util/TreeSet.java      2001/02/18 15:31:06
@@ -44,8 +44,6 @@
  * TreeSet is a part of the JDK1.2 Collections API.
  *
  * @author      Jon Zeppieri
- * @version     $Revision: 1.9 $
- * @modified    $Id: TreeSet.java,v 1.9 2001/02/16 02:04:23 bryce Exp $
  */
 
 public class TreeSet extends AbstractSet

Reply via email to