[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

DxHashMap can't clone when empty



Hi all,

The title says it all really.  On a 1.1 VM DxHashMap.clone() ends up
calling new Hashtable(count()) where count() is the number of elements in
the map.  However, when count() is 0 this is a bad thing.  The following
version of clone() works:

    public Object clone() {
    	int newSize = count();
    	if (newSize < 10)
    		newSize = 10;
        DxMap newMap = new DxHashMap (newSize);
        return clone (newMap);
        }

later,

\x/ill        :-}

P.S.  If you are working with a 1.1 VM you'll want to get the sun 1.1
collections library from:
<http://java.sun.com/beans/infobus/index.html#DOWNLOAD_COLLECTIONS>

and then put the following import in some of the ODMG classes:

import com.sun.java.util.collections.*;	// import java.util.*;

into:

ArrayOfObject.java
DArray.java
DCollection.java
DIterator.java
DList.java
DSet.java

you also need to remove some full qualification (e.g. turn java.util.List
into List) and rely on the import.