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

Re: DxHashMap can't clone when empty



On Tue, 15 Feb 2000, William Uther wrote:
> 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);
>         }
Thanks for the fix! On my Alpha, jdk1.2 the 0 size for the hashtable is no
problem. :|

> 
> 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.
Thanks for the info. We will look at ODMG collection in the next days. 


Falko
-- 
______________________________________________________________________
Falko Braeutigam                         mailto:falko@softwarebuero.de
softwarebuero m&b (SMB)                    http://www.softwarebuero.de