On 16 Apr 2001 [EMAIL PROTECTED] wrote:

> jvanzyl     01/04/16 15:42:04
> 
>   Modified:    collections/src/test/org/apache/commons/collections
>                         TestAll.java
>   Added:       collections/src/java/org/apache/commons/collections
>                         FastArrayList.java FastHashMap.java
>                         FastTreeMap.java
>                collections/src/test/org/apache/commons/collections
>                         TestFastArrayList.java TestFastHashMap.java
>                         TestFastTreeMap.java
>   Log:
>   - adding some utilities from struts into the collections packages
>     along with some (admittedly weak for now) tests.
>   

Jason,

I think we should conform to Rodney's original test architecture, such
that (for example) TestFastArrayList would extend TestList instead of
TestCase.  That's because TestList tests the contracts for java.util.List
(independent of the actual implementation), so cascading in this way means
that TestFastArrayList would have to pass all the TestList tests as well.

It looks like time to create a TestMap class that TestFastHashMap and
TestFastTreeMap would subclass also.

Craig
>           } else {
>               synchronized (list) {
>                   return (list.lastIndexOf(element));
>               }
>           }
>   
>       }
>   
>   
>       /**
>        * Return an iterator of the elements of this list, in proper sequence.
>        * See the implementation note on <code>iterator()</code>.
>        */
>       public ListIterator listIterator() {
>   
>           if (fast) {
>               return (list.listIterator());
>           } else {
>               synchronized (list) {
>                   return (list.listIterator());
>               }
>           }
>   
>       }
>   
>   
>       /**
>        * Return an iterator of the elements of this list, in proper sequence,
>        * starting at the specified position.
>        * See the implementation note on <code>iterator()</code>.
>        *
>        * @param index The starting position of the iterator to return
>        *
>        * @exception IndexOutOfBoundsException if the index is out of range
>        */
>       public ListIterator listIterator(int index) {
>   
>           if (fast) {
>               return (list.listIterator(index));
>           } else {
>               synchronized (list) {
>                   return (list.listIterator(index));
>               }
>           }
>   
>       }
>   
>   
>       /**
>        * Remove the element at the specified position in the list, and shift
>        * any subsequent elements down one position.
>        *
>        * @param index Index of the element to be removed
>        *
>        * @exception IndexOutOfBoundsException if the index is out of range
>        */
>       public Object remove(int index) {
>   
>           if (fast) {
>               synchronized (this) {
>                   ArrayList temp = (ArrayList) list.clone();
>                   Object result = temp.remove(index);
>                   list = temp;
>                   return (result);
>               }
>           } else {
>               synchronized (list) {
>                   return (list.remove(index));
>               }
>           }
>   
>       }
>   
>   
>       /**
>        * Remove the first occurrence of the specified element from the list,
>        * and shift any subsequent elements down one position.
>        *
>        * @param element Element to be removed
>        */
>       public boolean remove(Object element) {
>   
>           if (fast) {
>               synchronized (this) {
>                   ArrayList temp = (ArrayList) list.clone();
>                   boolean result = temp.remove(element);
>                   list = temp;
>                   return (result);
>               }
>           } else {
>               synchronized (list) {
>                   return (list.remove(element));
>               }
>           }
>   
>       }
>   
>   
>       /**
>        * Remove from this collection all of its elements that are contained
>        * in the specified collection.
>        *
>        * @param collection Collection containing elements to be removed
>        *
>        * @exception UnsupportedOperationException if this optional operation
>        *  is not supported by this list
>        */
>       public boolean removeAll(Collection collection) {
>   
>           if (fast) {
>               synchronized (this) {
>                   ArrayList temp = (ArrayList) list.clone();
>                   boolean result = temp.removeAll(collection);
>                   list = temp;
>                   return (result);
>               }
>           } else {
>               synchronized (list) {
>                   return (list.removeAll(collection));
>               }
>           }
>   
>       }
>   
>   
>       /**
>        * Remove from this collection all of its elements except those that are
>        * contained in the specified collection.
>        *
>        * @param collection Collection containing elements to be retained
>        *
>        * @exception UnsupportedOperationException if this optional operation
>        *  is not supported by this list
>        */
>       public boolean retainAll(Collection collection) {
>   
>           if (fast) {
>               synchronized (this) {
>                   ArrayList temp = (ArrayList) list.clone();
>                   boolean result = temp.retainAll(collection);
>                   list = temp;
>                   return (result);
>               }
>           } else {
>               synchronized (list) {
>                   return (list.retainAll(collection));
>               }
>           }
>   
>       }
>   
>   
>       /**
>        * Replace the element at the specified position in this list with
>        * the specified element.  Returns the previous object at that position.
>        * <br><br>
>        * <strong>IMPLEMENTATION NOTE</strong> - This operation is specifically
>        * documented to not be a structural change, so it is safe to be performed
>        * without cloning.
>        *
>        * @param index Index of the element to replace
>        * @param element The new element to be stored
>        *
>        * @exception IndexOutOfBoundsException if the index is out of range
>        */
>       public Object set(int index, Object element) {
>   
>           if (fast) {
>               return (list.set(index, element));
>           } else {
>               synchronized (list) {
>                   return (list.set(index, element));
>               }
>           }
>   
>       }
>   
>   
>       /**
>        * Return the number of elements in this list.
>        */
>       public int size() {
>   
>           if (fast) {
>               return (list.size());
>           } else {
>               synchronized (list) {
>                   return (list.size());
>               }
>           }
>   
>       }
>   
>   
>       /**
>        * Return a view of the portion of this list between fromIndex
>        * (inclusive) and toIndex (exclusive).  The returned list is backed
>        * by this list, so non-structural changes in the returned list are
>        * reflected in this list.  The returned list supports
>        * all of the optional list operations supported by this list.
>        *
>        * @param fromIndex The starting index of the sublist view
>        * @param toIndex The index after the end of the sublist view
>        *
>        * @exception IndexOutOfBoundsException if an index is out of range
>        */
>       public List subList(int fromIndex, int toIndex) {
>   
>           if (fast) {
>               return (list.subList(fromIndex, toIndex));
>           } else {
>               synchronized (list) {
>                   return (list.subList(fromIndex, toIndex));
>               }
>           }
>   
>       }
>   
>   
>       /**
>        * Return an array containing all of the elements in this list in the
>        * correct order.
>        */
>       public Object[] toArray() {
>   
>           if (fast) {
>               return (list.toArray());
>           } else {
>               synchronized (list) {
>                   return (list.toArray());
>               }
>           }
>   
>       }
>   
>   
>       /**
>        * Return an array containing all of the elements in this list in the
>        * correct order.  The runtime type of the returned array is that of
>        * the specified array.  If the list fits in the specified array, it is
>        * returned therein.  Otherwise, a new array is allocated with the
>        * runtime type of the specified array, and the size of this list.
>        *
>        * @param array Array defining the element type of the returned list
>        *
>        * @exception ArrayStoreException if the runtime type of <code>array</code>
>        *  is not a supertype of the runtime type of every element in this list
>        */
>       public Object[] toArray(Object array[]) {
>   
>           if (fast) {
>               return (list.toArray(array));
>           } else {
>               synchronized (list) {
>                   return (list.toArray(array));
>               }
>           }
>   
>       }
>   
>   
>       /**
>        * Return a String representation of this object.
>        */
>       public String toString() {
>   
>           StringBuffer sb = new StringBuffer("FastArrayList[");
>           sb.append(list.toString());
>           sb.append("]");
>           return (sb.toString());
>   
>       }
>   
>   
>       /**
>        * Trim the capacity of this <code>ArrayList</code> instance to be the
>        * list's current size.  An application can use this operation to minimize
>        * the storage of an <code>ArrayList</code> instance.
>        */
>       public void trimToSize() {
>   
>           if (fast) {
>               synchronized (this) {
>                   ArrayList temp = (ArrayList) list.clone();
>                   temp.trimToSize();
>                   list = temp;
>               }
>           } else {
>               synchronized (list) {
>                   list.trimToSize();
>               }
>           }
>   
>       }
>   
>   
>   }
>   
>   
>   
>   1.1                  
>jakarta-commons/collections/src/java/org/apache/commons/collections/FastHashMap.java
>   
>   Index: FastHashMap.java
>   ===================================================================
>   /*
>    * $Header: 
>/home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/FastHashMap.java,v
> 1.1 2001/04/16 22:42:04 jvanzyl Exp $
>    * $Revision: 1.1 $
>    * $Date: 2001/04/16 22:42:04 $
>    *
>    * ====================================================================
>    *
>    * The Apache Software License, Version 1.1
>    *
>    * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
>    * reserved.
>    *
>    * Redistribution and use in source and binary forms, with or without
>    * modification, are permitted provided that the following conditions
>    * are met:
>    *
>    * 1. Redistributions of source code must retain the above copyright
>    *    notice, this list of conditions and the following disclaimer.
>    *
>    * 2. Redistributions in binary form must reproduce the above copyright
>    *    notice, this list of conditions and the following disclaimer in
>    *    the documentation and/or other materials provided with the
>    *    distribution.
>    *
>    * 3. The end-user documentation included with the redistribution, if
>    *    any, must include the following acknowlegement:
>    *       "This product includes software developed by the
>    *        Apache Software Foundation (http://www.apache.org/)."
>    *    Alternately, this acknowlegement may appear in the software itself,
>    *    if and wherever such third-party acknowlegements normally appear.
>    *
>    * 4. The names "The Jakarta Project", "Commons", and "Apache Software
>    *    Foundation" must not be used to endorse or promote products derived
>    *    from this software without prior written permission. For written
>    *    permission, please contact [EMAIL PROTECTED]
>    *
>    * 5. Products derived from this software may not be called "Apache"
>    *    nor may "Apache" appear in their names without prior written
>    *    permission of the Apache Group.
>    *
>    * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
>    * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
>    * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
>    * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
>    * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
>    * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
>    * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
>    * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
>    * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
>    * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
>    * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
>    * SUCH DAMAGE.
>    * ====================================================================
>    *
>    * This software consists of voluntary contributions made by many
>    * individuals on behalf of the Apache Software Foundation.  For more
>    * information on the Apache Software Foundation, please see
>    * <http://www.apache.org/>.
>    *
>    */
>   
>   
>   package org.apache.commons.collections;
>   
>   
>   import java.io.Serializable;
>   import java.util.Collection;
>   import java.util.HashMap;
>   import java.util.Iterator;
>   import java.util.Map;
>   import java.util.Set;
>   
>   
>   /**
>    * <p>A customized implementation of <code>java.util.HashMap</code> designed
>    * to operate in a multithreaded environment where the large majority of
>    * method calls are read-only, instead of structural changes.  When operating
>    * in "fast" mode, read calls are non-synchronized and write calls perform the
>    * following steps:</p>
>    * <ul>
>    * <li>Clone the existing collection
>    * <li>Perform the modification on the clone
>    * <li>Replace the existing collection with the (modified) clone
>    * </ul>
>    * <p>When first created, objects of this class default to "slow" mode, where
>    * all accesses of any type are synchronized but no cloning takes place.  This
>    * is appropriate for initially populating the collection, followed by a switch
>    * to "fast" mode (by calling <code>setFast(true)</code>) after initialization
>    * is complete.</p>
>    *
>    * <p><strong>NOTE</strong>: If you are creating and accessing a
>    * <code>HashMap</code> only within a single thread, you should use
>    * <code>java.util.HashMap</code> directly (with no synchronization), for
>    * maximum performance.</p>
>    *
>    * <p><strong>NOTE</strong>: The following methods are <strong>NOT</strong>
>    * overridden:  clone(), equals(Object), hashCode().</p>
>    *
>    * @author Craig R. McClanahan
>    * @version $Revision: 1.1 $ $Date: 2001/04/16 22:42:04 $
>    */
>   
>   public class FastHashMap implements Map, Cloneable, Serializable {
>   
>   
>       // ----------------------------------------------------------- Constructors
>   
>   
>       /**
>        * Construct a an empty map.
>        */
>       public FastHashMap() {
>   
>           super();
>           this.map = new HashMap();
>   
>       }
>   
>   
>       /**
>        * Construct an empty map with the specified capacity.
>        *
>        * @param capacity The initial capacity of the empty map
>        */
>       public FastHashMap(int capacity) {
>   
>           super();
>           this.map = new HashMap(capacity);
>   
>       }
>   
>   
>       /**
>        * Construct an empty map with the specified capacity and load factor.
>        *
>        * @param capacity The initial capacity of the empty map
>        * @param factor The load factor of the new map
>        */
>       public FastHashMap(int capacity, float factor) {
>   
>           super();
>           this.map = new HashMap(capacity, factor);
>   
>       }
>   
>   
>       /**
>        * Construct a new map with the same mappings as the specified map.
>        *
>        * @param map The map whose mappings are to be copied
>        */
>       public FastHashMap(Map map) {
>   
>           super();
>           this.map = new HashMap(map);
>   
>       }
>   
>   
>       // ----------------------------------------------------- Instance Variables
>   
>   
>       /**
>        * The underlying map we are managing.
>        */
>       protected HashMap map = null;
>   
>   
>       // ------------------------------------------------------------- Properties
>   
>   
>       /**
>        * Are we operating in "fast" mode?
>        */
>       protected boolean fast = false;
>   
>       public boolean getFast() {
>           return (this.fast);
>       }
>   
>       public void setFast(boolean fast) {
>           this.fast = fast;
>       }
>   
>   
>       // --------------------------------------------------------- Public Methods
>   
>   
>       /**
>        * Remove all mappings from this map.
>        */
>       public void clear() {
>   
>           if (fast) {
>               synchronized (this) {
>                   HashMap temp = (HashMap) map.clone();
>                   temp.clear();
>                   map = temp;
>               }
>           } else {
>               synchronized (map) {
>                   map.clear();
>               }
>           }
>   
>       }
>   
>   
>       /**
>        * Return <code>true</code> if this map contains a mapping for the
>        * specified key.
>        *
>        * @param key Key to be searched for
>        */
>       public boolean containsKey(Object key) {
>   
>           if (fast) {
>               return (map.containsKey(key));
>           } else {
>               synchronized (map) {
>                   return (map.containsKey(key));
>               }
>           }
>   
>       }
>   
>   
>       /**
>        * Return <code>true</code> if this map contains one or more keys mapping
>        * to the specified value.
>        *
>        * @param value Value to be searched for
>        */
>       public boolean containsValue(Object value) {
>   
>           if (fast) {
>               return (map.containsValue(value));
>           } else {
>               synchronized (map) {
>                   return (map.containsValue(value));
>               }
>           }
>   
>       }
>   
>   
>       /**
>        * Return a collection view of the mappings contained in this map.  Each
>        * element in the returned collection is a <code>Map.Entry</code>.
>        */
>       public Set entrySet() {
>   
>           if (fast) {
>               return (map.entrySet());
>           } else {
>               synchronized (map) {
>                   return (map.entrySet());
>               }
>           }
>   
>       }
>   
>   
>       /**
>        * Return the value to which this map maps the specified key.  Returns
>        * <code>null</code> if the map contains no mapping for this key, or if
>        * there is a mapping with a value of <code>null</code>.  Use the
>        * <code>containsKey()</code> method to disambiguate these cases.
>        *
>        * @param key Key whose value is to be returned
>        */
>       public Object get(Object key) {
>   
>           if (fast) {
>               return (map.get(key));
>           } else {
>               synchronized (map) {
>                   return (map.get(key));
>               }
>           }
>   
>       }
>   
>   
>       /**
>        * Return <code>true</code> if this map contains no mappings.
>        */
>       public boolean isEmpty() {
>   
>           if (fast) {
>               return (map.isEmpty());
>           } else {
>               synchronized (map) {
>                   return (map.isEmpty());
>               }
>           }
>   
>       }
>   
>   
>       /**
>        * Return a set view of the keys contained in this map.
>        */
>       public Set keySet() {
>   
>           if (fast) {
>               return (map.keySet());
>           } else {
>               synchronized (map) {
>                   return (map.keySet());
>               }
>           }
>   
>       }
>   
>   
>       /**
>        * Associate the specified value with the specified key in this map.
>        * If the map previously contained a mapping for this key, the old
>        * value is replaced and returned.
>        *
>        * @param key The key with which the value is to be associated
>        * @param value The value to be associated with this key
>        */
>       public Object put(Object key, Object value) {
>   
>           if (fast) {
>               synchronized (this) {
>                   HashMap temp = (HashMap) map.clone();
>                   Object result = temp.put(key, value);
>                   map = temp;
>                   return (result);
>               }
>           } else {
>               synchronized (map) {
>                   return (map.put(key, value));
>               }
>           }
>   
>       }
>   
>   
>       /**
>        * Copy all of the mappings from the specified map to this one, replacing
>        * any mappings with the same keys.
>        *
>        * @param in Map whose mappings are to be copied
>        */
>       public void putAll(Map in) {
>   
>           if (fast) {
>               synchronized (this) {
>                   HashMap temp = (HashMap) map.clone();
>                   temp.putAll(in);
>                   map = temp;
>               }
>           } else {
>               synchronized (map) {
>                   map.putAll(in);
>               }
>           }
>   
>       }
>   
>   
>       /**
>        * Remove any mapping for this key, and return any previously
>        * mapped value.
>        *
>        * @param key Key whose mapping is to be removed
>        */
>       public Object remove(Object key) {
>   
>           if (fast) {
>               synchronized (this) {
>                   HashMap temp = (HashMap) map.clone();
>                   Object result = temp.remove(key);
>                   map = temp;
>                   return (result);
>               }
>           } else {
>               synchronized (map) {
>                   return (map.remove(key));
>               }
>           }
>   
>       }
>   
>   
>       /**
>        * Return the number of key-value mappings in this map.
>        */
>       public int size() {
>   
>           if (fast) {
>               return (map.size());
>           } else {
>               synchronized (map) {
>                   return (map.size());
>               }
>           }
>   
>       }
>   
>   
>       /**
>        * Return a collection view of the values contained in this map.
>        */
>       public Collection values() {
>   
>           if (fast) {
>               return (map.values());
>           } else {
>               synchronized (map) {
>                   return (map.values());
>               }
>           }
>   
>       }
>   
>   
>   }
>   
>   
>   
>   1.1                  
>jakarta-commons/collections/src/java/org/apache/commons/collections/FastTreeMap.java
>   
>   Index: FastTreeMap.java
>   ===================================================================
>   /*
>    * $Header: 
>/home/cvs/jakarta-commons/collections/src/java/org/apache/commons/collections/FastTreeMap.java,v
> 1.1 2001/04/16 22:42:04 jvanzyl Exp $
>    * $Revision: 1.1 $
>    * $Date: 2001/04/16 22:42:04 $
>    *
>    * ====================================================================
>    *
>    * The Apache Software License, Version 1.1
>    *
>    * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
>    * reserved.
>    *
>    * Redistribution and use in source and binary forms, with or without
>    * modification, are permitted provided that the following conditions
>    * are met:
>    *
>    * 1. Redistributions of source code must retain the above copyright
>    *    notice, this list of conditions and the following disclaimer.
>    *
>    * 2. Redistributions in binary form must reproduce the above copyright
>    *    notice, this list of conditions and the following disclaimer in
>    *    the documentation and/or other materials provided with the
>    *    distribution.
>    *
>    * 3. The end-user documentation included with the redistribution, if
>    *    any, must include the following acknowlegement:
>    *       "This product includes software developed by the
>    *        Apache Software Foundation (http://www.apache.org/)."
>    *    Alternately, this acknowlegement may appear in the software itself,
>    *    if and wherever such third-party acknowlegements normally appear.
>    *
>    * 4. The names "The Jakarta Project", "Commons", and "Apache Software
>    *    Foundation" must not be used to endorse or promote products derived
>    *    from this software without prior written permission. For written
>    *    permission, please contact [EMAIL PROTECTED]
>    *
>    * 5. Products derived from this software may not be called "Apache"
>    *    nor may "Apache" appear in their names without prior written
>    *    permission of the Apache Group.
>    *
>    * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
>    * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
>    * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
>    * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
>    * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
>    * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
>    * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
>    * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
>    * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
>    * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
>    * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
>    * SUCH DAMAGE.
>    * ====================================================================
>    *
>    * This software consists of voluntary contributions made by many
>    * individuals on behalf of the Apache Software Foundation.  For more
>    * information on the Apache Software Foundation, please see
>    * <http://www.apache.org/>.
>    *
>    */
>   
>   
>   package org.apache.commons.collections;
>   
>   
>   import java.io.Serializable;
>   import java.util.Collection;
>   import java.util.Comparator;
>   import java.util.Iterator;
>   import java.util.Map;
>   import java.util.Set;
>   import java.util.SortedMap;
>   import java.util.TreeMap;
>   
>   
>   /**
>    * <p>A customized implementation of <code>java.util.TreeMap</code> designed
>    * to operate in a multithreaded environment where the large majority of
>    * method calls are read-only, instead of structural changes.  When operating
>    * in "fast" mode, read calls are non-synchronized and write calls perform the
>    * following steps:</p>
>    * <ul>
>    * <li>Clone the existing collection
>    * <li>Perform the modification on the clone
>    * <li>Replace the existing collection with the (modified) clone
>    * </ul>
>    * <p>When first created, objects of this class default to "slow" mode, where
>    * all accesses of any type are synchronized but no cloning takes place.  This
>    * is appropriate for initially populating the collection, followed by a switch
>    * to "fast" mode (by calling <code>setFast(true)</code>) after initialization
>    * is complete.</p>
>    *
>    * <p><strong>NOTE</strong>: If you are creating and accessing a
>    * <code>TreeMap</code> only within a single thread, you should use
>    * <code>java.util.TreeMap</code> directly (with no synchronization), for
>    * maximum performance.</p>
>    *
>    * <p><strong>NOTE</strong>: The following methods are <strong>NOT</strong>
>    * overridden:  clone(), equals(Object), hashCode().</p>
>    *
>    * @author Craig R. McClanahan
>    * @version $Revision: 1.1 $ $Date: 2001/04/16 22:42:04 $
>    */
>   
>   public class FastTreeMap implements Map, Cloneable, Serializable {
>   
>   
>       // ----------------------------------------------------------- Constructors
>   
>   
>       /**
>        * Construct a an empty map.
>        */
>       public FastTreeMap() {
>   
>           super();
>           this.map = new TreeMap();
>   
>       }
>   
>   
>       /**
>        * Construct an empty map with the specified comparator.
>        *
>        * @param comparator The comparator to use for ordering tree elements
>        */
>       public FastTreeMap(Comparator comparator) {
>   
>           super();
>           this.map = new TreeMap(comparator);
>   
>       }
>   
>   
>       /**
>        * Construct a new map with the same mappings as the specified map,
>        * sorted according to the keys's natural order
>        *
>        * @param map The map whose mappings are to be copied
>        */
>       public FastTreeMap(Map map) {
>   
>           super();
>           this.map = new TreeMap(map);
>   
>       }
>   
>   
>       /**
>        * Construct a new map with the same mappings as the specified map,
>        * sorted according to the same ordering
>        *
>        * @param map The map whose mappings are to be copied
>        */
>       public FastTreeMap(SortedMap map) {
>   
>           super();
>           this.map = new TreeMap(map);
>   
>       }
>   
>   
>       // ----------------------------------------------------- Instance Variables
>   
>   
>       /**
>        * The underlying map we are managing.
>        */
>       protected TreeMap map = null;
>   
>   
>       // ------------------------------------------------------------- Properties
>   
>   
>       /**
>        * Are we operating in "fast" mode?
>        */
>       protected boolean fast = false;
>   
>       public boolean getFast() {
>           return (this.fast);
>       }
>   
>       public void setFast(boolean fast) {
>           this.fast = fast;
>       }
>   
>   
>       // --------------------------------------------------------- Public Methods
>   
>   
>       /**
>        * Remove all mappings from this map.
>        */
>       public void clear() {
>   
>           if (fast) {
>               synchronized (this) {
>                   TreeMap temp = (TreeMap) map.clone();
>                   temp.clear();
>                   map = temp;
>               }
>           } else {
>               synchronized (map) {
>                   map.clear();
>               }
>           }
>   
>       }
>   
>   
>       /**
>        * Return the comparator used to order this map, or <code>null</code>
>        * if this map uses its keys' natural order.
>        */
>       public Comparator comparator() {
>   
>           if (fast) {
>               return (map.comparator());
>           } else {
>               synchronized (map) {
>                   return (map.comparator());
>               }
>           }
>   
>       }
>   
>   
>       /**
>        * Return <code>true</code> if this map contains a mapping for the
>        * specified key.
>        *
>        * @param key Key to be searched for
>        */
>       public boolean containsKey(Object key) {
>   
>           if (fast) {
>               return (map.containsKey(key));
>           } else {
>               synchronized (map) {
>                   return (map.containsKey(key));
>               }
>           }
>   
>       }
>   
>   
>       /**
>        * Return <code>true</code> if this map contains one or more keys mapping
>        * to the specified value.
>        *
>        * @param value Value to be searched for
>        */
>       public boolean containsValue(Object value) {
>   
>           if (fast) {
>               return (map.containsValue(value));
>           } else {
>               synchronized (map) {
>                   return (map.containsValue(value));
>               }
>           }
>   
>       }
>   
>   
>       /**
>        * Return a collection view of the mappings contained in this map.  Each
>        * element in the returned collection is a <code>Map.Entry</code>.
>        */
>       public Set entrySet() {
>   
>           if (fast) {
>               return (map.entrySet());
>           } else {
>               synchronized (map) {
>                   return (map.entrySet());
>               }
>           }
>   
>       }
>   
>   
>       /**
>        * Return the first (lowest) key currently in this sorted map.
>        */
>       public Object firstKey() {
>   
>           if (fast) {
>               return (map.firstKey());
>           } else {
>               synchronized (map) {
>                   return (map.firstKey());
>               }
>           }
>   
>       }
>   
>   
>       /**
>        * Return the value to which this map maps the specified key.  Returns
>        * <code>null</code> if the map contains no mapping for this key, or if
>        * there is a mapping with a value of <code>null</code>.  Use the
>        * <code>containsKey()</code> method to disambiguate these cases.
>        *
>        * @param key Key whose value is to be returned
>        */
>       public Object get(Object key) {
>   
>           if (fast) {
>               return (map.get(key));
>           } else {
>               synchronized (map) {
>                   return (map.get(key));
>               }
>           }
>   
>       }
>   
>   
>       /**
>        * Return a view of the portion of this map whose keys are strictly
>        * less than the specified key.
>        *
>        * @param key Key higher than any in the returned map
>        */
>       public SortedMap headMap(Object key) {
>   
>           if (fast) {
>               return (map.headMap(key));
>           } else {
>               synchronized (map) {
>                   return (map.headMap(key));
>               }
>           }
>   
>       }
>   
>   
>       /**
>        * Test if this list has no elements.
>        */
>       public boolean isEmpty() {
>   
>           if (fast) {
>               return (map.isEmpty());
>           } else {
>               synchronized (map) {
>                   return (map.isEmpty());
>               }
>           }
>   
>       }
>   
>   
>       /**
>        * Return a set view of the keys contained in this map.
>        */
>       public Set keySet() {
>   
>           if (fast) {
>               return (map.keySet());
>           } else {
>               synchronized (map) {
>                   return (map.keySet());
>               }
>           }
>   
>       }
>   
>   
>       /**
>        * Return the last (highest) key currently in this sorted map.
>        */
>       public Object lastKey() {
>   
>           if (fast) {
>               return (map.lastKey());
>           } else {
>               synchronized (map) {
>                   return (map.lastKey());
>               }
>           }
>   
>       }
>   
>   
>       /**
>        * Associate the specified value with the specified key in this map.
>        * If the map previously contained a mapping for this key, the old
>        * value is replaced and returned.
>        *
>        * @param key The key with which the value is to be associated
>        * @param value The value to be associated with this key
>        */
>       public Object put(Object key, Object value) {
>   
>           if (fast) {
>               synchronized (this) {
>                   TreeMap temp = (TreeMap) map.clone();
>                   Object result = temp.put(key, value);
>                   map = temp;
>                   return (result);
>               }
>           } else {
>               synchronized (map) {
>                   return (map.put(key, value));
>               }
>           }
>   
>       }
>   
>   
>       /**
>        * Copy all of the mappings from the specified map to this one, replacing
>        * any mappings with the same keys.
>        *
>        * @param in Map whose mappings are to be copied
>        */
>       public void putAll(Map in) {
>   
>           if (fast) {
>               synchronized (this) {
>                   TreeMap temp = (TreeMap) map.clone();
>                   temp.putAll(in);
>                   map = temp;
>               }
>           } else {
>               synchronized (map) {
>                   map.putAll(in);
>               }
>           }
>   
>       }
>   
>   
>       /**
>        * Remove any mapping for this key, and return any previously
>        * mapped value.
>        *
>        * @param key Key whose mapping is to be removed
>        */
>       public Object remove(Object key) {
>   
>           if (fast) {
>               synchronized (this) {
>                   TreeMap temp = (TreeMap) map.clone();
>                   Object result = temp.remove(key);
>                   map = temp;
>                   return (result);
>               }
>           } else {
>               synchronized (map) {
>                   return (map.remove(key));
>               }
>           }
>   
>       }
>   
>   
>       /**
>        * Return the number of key-value mappings in this map.
>        */
>       public int size() {
>   
>           if (fast) {
>               return (map.size());
>           } else {
>               synchronized (map) {
>                   return (map.size());
>               }
>           }
>   
>       }
>   
>   
>       /**
>        * Return a view of the portion of this map whose keys are in the
>        * range fromKey (inclusive) to toKey (exclusive).
>        *
>        * @param fromKey Lower limit of keys for the returned map
>        * @param toKey Upper limit of keys for the returned map
>        */
>       public SortedMap subMap(Object fromKey, Object toKey) {
>   
>           if (fast) {
>               return (map.subMap(fromKey, toKey));
>           } else {
>               synchronized (map) {
>                   return (map.subMap(fromKey, toKey));
>               }
>           }
>   
>       }
>   
>   
>       /**
>        * Return a view of the portion of this map whose keys are greater than
>        * or equal to the specified key.
>        *
>        * @param key Key less than or equal to any in the returned map
>        */
>       public SortedMap tailMap(Object key) {
>   
>           if (fast) {
>               return (map.tailMap(key));
>           } else {
>               synchronized (map) {
>                   return (map.tailMap(key));
>               }
>           }
>   
>       }
>   
>   
>       /**
>        * Return a collection view of the values contained in this map.
>        */
>       public Collection values() {
>   
>           if (fast) {
>               return (map.values());
>           } else {
>               synchronized (map) {
>                   return (map.values());
>               }
>           }
>   
>       }
>   
>   
>   }
>   
>   
>   
>   1.3       +7 -4      
>jakarta-commons/collections/src/test/org/apache/commons/collections/TestAll.java
>   
>   Index: TestAll.java
>   ===================================================================
>   RCS file: 
>/home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/TestAll.java,v
>   retrieving revision 1.2
>   retrieving revision 1.3
>   diff -u -r1.2 -r1.3
>   --- TestAll.java    2001/04/14 19:32:38     1.2
>   +++ TestAll.java    2001/04/16 22:42:04     1.3
>   @@ -1,7 +1,7 @@
>    /*
>   - * $Header: 
>/home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/TestAll.java,v
> 1.2 2001/04/14 19:32:38 craigmcc Exp $
>   - * $Revision: 1.2 $
>   - * $Date: 2001/04/14 19:32:38 $
>   + * $Header: 
>/home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/TestAll.java,v
> 1.3 2001/04/16 22:42:04 jvanzyl Exp $
>   + * $Revision: 1.3 $
>   + * $Date: 2001/04/16 22:42:04 $
>     *
>     * ====================================================================
>     *
>   @@ -65,7 +65,7 @@
>    
>    /**
>     * @author Rodney Waldhoff
>   - * @version $Id: TestAll.java,v 1.2 2001/04/14 19:32:38 craigmcc Exp $
>   + * @version $Id: TestAll.java,v 1.3 2001/04/16 22:42:04 jvanzyl Exp $
>     */
>    public class TestAll extends TestCase {
>        public TestAll(String testName) {
>   @@ -76,6 +76,9 @@
>            TestSuite suite = new TestSuite();
>            suite.addTest(TestArrayStack.suite());
>            suite.addTest(TestCursorableLinkedList.suite());
>   +        suite.addTest(TestFastArrayList.suite());
>   +        suite.addTest(TestFastHashMap.suite());
>   +        suite.addTest(TestFastTreeMap.suite());
>            return suite;
>        }
>    
>   
>   
>   
>   1.1                  
>jakarta-commons/collections/src/test/org/apache/commons/collections/TestFastArrayList.java
>   
>   Index: TestFastArrayList.java
>   ===================================================================
>   /*
>    * $Header: 
>/home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/TestFastArrayList.java,v
> 1.1 2001/04/16 22:42:04 jvanzyl Exp $
>    * $Revision: 1.1 $
>    * $Date: 2001/04/16 22:42:04 $
>    *
>    * ====================================================================
>    *
>    * The Apache Software License, Version 1.1
>    *
>    * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
>    * reserved.
>    *
>    * Redistribution and use in source and binary forms, with or without
>    * modification, are permitted provided that the following conditions
>    * are met:
>    *
>    * 1. Redistributions of source code must retain the above copyright
>    *    notice, this list of conditions and the following disclaimer.
>    *
>    * 2. Redistributions in binary form must reproduce the above copyright
>    *    notice, this list of conditions and the following disclaimer in
>    *    the documentation and/or other materials provided with the
>    *    distribution.
>    *
>    * 3. The end-user documentation included with the redistribution, if
>    *    any, must include the following acknowlegement:
>    *       "This product includes software developed by the
>    *        Apache Software Foundation (http://www.apache.org/)."
>    *    Alternately, this acknowlegement may appear in the software itself,
>    *    if and wherever such third-party acknowlegements normally appear.
>    *
>    * 4. The names "The Jakarta Project", "Commons", and "Apache Software
>    *    Foundation" must not be used to endorse or promote products derived
>    *    from this software without prior written permission. For written
>    *    permission, please contact [EMAIL PROTECTED]
>    *
>    * 5. Products derived from this software may not be called "Apache"
>    *    nor may "Apache" appear in their names without prior written
>    *    permission of the Apache Group.
>    *
>    * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
>    * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
>    * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
>    * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
>    * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
>    * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
>    * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
>    * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
>    * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
>    * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
>    * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
>    * SUCH DAMAGE.
>    * ====================================================================
>    *
>    * This software consists of voluntary contributions made by many
>    * individuals on behalf of the Apache Software Foundation.  For more
>    * information on the Apache Software Foundation, please see
>    * <http://www.apache.org/>.
>    *
>    */
>   
>   package org.apache.commons.collections;
>   
>   import junit.framework.Test;
>   import junit.framework.TestCase;
>   import junit.framework.TestSuite;
>   
>   /**
>    * @author <a href="mailto:[EMAIL PROTECTED]">Jason van Zyl</a>
>    * @version $Id: TestFastArrayList.java,v 1.1 2001/04/16 22:42:04 jvanzyl Exp $
>    */
>   public class TestFastArrayList extends TestCase
>   {
>       public TestFastArrayList(String testName) 
>       {
>           super(testName);
>       }
>   
>       public static Test suite() 
>       {
>           return new TestSuite(TestFastArrayList.class);
>       }
>   
>       public static void main(String args[]) 
>       {
>           String[] testCaseName = { TestFastArrayList.class.getName() };
>           junit.textui.TestRunner.main(testCaseName);
>       }
>   
>       private FastArrayList list = null;
>   
>       public void setUp() 
>       {
>           list = new FastArrayList();
>       }
>   
>       public void testNewFastArrayList() 
>       {
>           assert("New list is empty", list.isEmpty());
>           assertEquals("New list has size zero", list.size(), 0);
>   
>           try 
>           {
>               list.get(1);
>               fail("get(int i) should have thrown IndexOutOfBoundsException");
>           } 
>           catch (IndexOutOfBoundsException e)
>           {
>               ; // Expected result
>           }
>       }
>   
>       public void testSearch() 
>       {
>           list.add("First Item");
>           list.add("Last Item");
>           assertEquals("First item is 'First Item'", list.get(0), "First Item");
>           assertEquals("Last Item is 'Last Item'", list.get(1), "Last Item");
>       }
>   }
>   
>   
>   
>   1.1                  
>jakarta-commons/collections/src/test/org/apache/commons/collections/TestFastHashMap.java
>   
>   Index: TestFastHashMap.java
>   ===================================================================
>   /*
>    * $Header: 
>/home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/TestFastHashMap.java,v
> 1.1 2001/04/16 22:42:04 jvanzyl Exp $
>    * $Revision: 1.1 $
>    * $Date: 2001/04/16 22:42:04 $
>    *
>    * ====================================================================
>    *
>    * The Apache Software License, Version 1.1
>    *
>    * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
>    * reserved.
>    *
>    * Redistribution and use in source and binary forms, with or without
>    * modification, are permitted provided that the following conditions
>    * are met:
>    *
>    * 1. Redistributions of source code must retain the above copyright
>    *    notice, this list of conditions and the following disclaimer.
>    *
>    * 2. Redistributions in binary form must reproduce the above copyright
>    *    notice, this list of conditions and the following disclaimer in
>    *    the documentation and/or other materials provided with the
>    *    distribution.
>    *
>    * 3. The end-user documentation included with the redistribution, if
>    *    any, must include the following acknowlegement:
>    *       "This product includes software developed by the
>    *        Apache Software Foundation (http://www.apache.org/)."
>    *    Alternately, this acknowlegement may appear in the software itself,
>    *    if and wherever such third-party acknowlegements normally appear.
>    *
>    * 4. The names "The Jakarta Project", "Commons", and "Apache Software
>    *    Foundation" must not be used to endorse or promote products derived
>    *    from this software without prior written permission. For written
>    *    permission, please contact [EMAIL PROTECTED]
>    *
>    * 5. Products derived from this software may not be called "Apache"
>    *    nor may "Apache" appear in their names without prior written
>    *    permission of the Apache Group.
>    *
>    * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
>    * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
>    * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
>    * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
>    * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
>    * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
>    * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
>    * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
>    * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
>    * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
>    * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
>    * SUCH DAMAGE.
>    * ====================================================================
>    *
>    * This software consists of voluntary contributions made by many
>    * individuals on behalf of the Apache Software Foundation.  For more
>    * information on the Apache Software Foundation, please see
>    * <http://www.apache.org/>.
>    *
>    */
>   
>   package org.apache.commons.collections;
>   
>   import junit.framework.Test;
>   import junit.framework.TestCase;
>   import junit.framework.TestSuite;
>   
>   /**
>    * @author <a href="mailto:[EMAIL PROTECTED]">Jason van Zyl</a>
>    * @version $Id: TestFastHashMap.java,v 1.1 2001/04/16 22:42:04 jvanzyl Exp $
>    */
>   public class TestFastHashMap extends TestCase
>   {
>       public TestFastHashMap(String testName) 
>       {
>           super(testName);
>       }
>   
>       public static Test suite() 
>       {
>           return new TestSuite(TestFastHashMap.class);
>       }
>   
>       public static void main(String args[]) 
>       {
>           String[] testCaseName = { TestFastHashMap.class.getName() };
>           junit.textui.TestRunner.main(testCaseName);
>       }
>   
>       private FastHashMap map = null;
>   
>       public void setUp() 
>       {
>           map = new FastHashMap();
>       }
>   
>       public void testNewMap() 
>       {
>           assert("New map is empty", map.isEmpty());
>           assertEquals("New map has size zero", map.size(), 0);
>       }
>   
>       public void testSearch() 
>       {
>           map.put("first", "First Item");
>           map.put("second", "Second Item");
>           assertEquals("Top item is 'Second Item'", map.get("first"), "First Item");
>           assertEquals("Next Item is 'First Item'", map.get("second"), "Second 
>Item");
>       }
>   }
>   
>   
>   
>   1.1                  
>jakarta-commons/collections/src/test/org/apache/commons/collections/TestFastTreeMap.java
>   
>   Index: TestFastTreeMap.java
>   ===================================================================
>   /*
>    * $Header: 
>/home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/TestFastTreeMap.java,v
> 1.1 2001/04/16 22:42:04 jvanzyl Exp $
>    * $Revision: 1.1 $
>    * $Date: 2001/04/16 22:42:04 $
>    *
>    * ====================================================================
>    *
>    * The Apache Software License, Version 1.1
>    *
>    * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
>    * reserved.
>    *
>    * Redistribution and use in source and binary forms, with or without
>    * modification, are permitted provided that the following conditions
>    * are met:
>    *
>    * 1. Redistributions of source code must retain the above copyright
>    *    notice, this list of conditions and the following disclaimer.
>    *
>    * 2. Redistributions in binary form must reproduce the above copyright
>    *    notice, this list of conditions and the following disclaimer in
>    *    the documentation and/or other materials provided with the
>    *    distribution.
>    *
>    * 3. The end-user documentation included with the redistribution, if
>    *    any, must include the following acknowlegement:
>    *       "This product includes software developed by the
>    *        Apache Software Foundation (http://www.apache.org/)."
>    *    Alternately, this acknowlegement may appear in the software itself,
>    *    if and wherever such third-party acknowlegements normally appear.
>    *
>    * 4. The names "The Jakarta Project", "Commons", and "Apache Software
>    *    Foundation" must not be used to endorse or promote products derived
>    *    from this software without prior written permission. For written
>    *    permission, please contact [EMAIL PROTECTED]
>    *
>    * 5. Products derived from this software may not be called "Apache"
>    *    nor may "Apache" appear in their names without prior written
>    *    permission of the Apache Group.
>    *
>    * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
>    * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
>    * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
>    * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
>    * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
>    * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
>    * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
>    * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
>    * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
>    * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
>    * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
>    * SUCH DAMAGE.
>    * ====================================================================
>    *
>    * This software consists of voluntary contributions made by many
>    * individuals on behalf of the Apache Software Foundation.  For more
>    * information on the Apache Software Foundation, please see
>    * <http://www.apache.org/>.
>    *
>    */
>   
>   package org.apache.commons.collections;
>   
>   import junit.framework.Test;
>   import junit.framework.TestCase;
>   import junit.framework.TestSuite;
>   
>   /**
>    * @author <a href="mailto:[EMAIL PROTECTED]">Jason van Zyl</a>
>    * @version $Id: TestFastTreeMap.java,v 1.1 2001/04/16 22:42:04 jvanzyl Exp $
>    */
>   public class TestFastTreeMap extends TestCase
>   {
>       public TestFastTreeMap(String testName) 
>       {
>           super(testName);
>       }
>   
>       public static Test suite() 
>       {
>           return new TestSuite(TestFastTreeMap.class);
>       }
>   
>       public static void main(String args[]) 
>       {
>           String[] testCaseName = { TestFastTreeMap.class.getName() };
>           junit.textui.TestRunner.main(testCaseName);
>       }
>   
>       private FastTreeMap map = null;
>   
>       public void setUp() 
>       {
>           map = new FastTreeMap();
>       }
>   
>       public void testNewMap() 
>       {
>           assert("New map is empty", map.isEmpty());
>           assertEquals("New map has size zero", map.size(), 0);
>       }
>   
>       public void testSearch() 
>       {
>           map.put("first", "First Item");
>           map.put("second", "Second Item");
>           assertEquals("Top item is 'Second Item'", map.get("first"), "First Item");
>           assertEquals("Next Item is 'First Item'", map.get("second"), "Second 
>Item");
>       }
>   }
>   
>   
>   
> 

Reply via email to