Re: How to create array of hash table with correct types



Create the array slots  in one step, then initialise the slots in a
statement each.


Thanks for your reply. I am still not sure I get it.

Hashtable<String, NodeAddress>[] cache = new Hashtable;
cache[0] = new Hashtable<String, NodeAddress>();
cache[1] = new Hashtable<String, NodeAddress>();
cache[2] = new Hashtable<String, NodeAddress>();

This compiles with warnings since the type of the type of the
Hashtable array is not set correctly, "Uses unsafe operations...".

My experience with the type stuff in Java is a bit rusty. Sorry.

Replacing in the above code:
Hashtable<String, NodeAddress>[] cache = new Hashtable;
with:
Hashtable<String, NodeAddress>[] cache = new Hashtable<String,
NodeAddress>[3];
blows up with "generic array creation"

How can I do it properly?


Jon.
.