extending a generic class

hi all,

i want to extends a generic class, HashTable<K,V> to be concrete , but i want my class would be in use as MyHashTable<String, String>

does any one know the syntax for that ?

what i actually mean is how do i set the generics data types in the inheritance mechanism ?

thanks

Jaimon

[338 byte] By [kal.lizkora] at [2007-10-3 3:17:29]
# 1

> hi all,

>

> i want to extends a generic class, HashTable<K,V> to

> be concrete , but i want my class would be in use as

> MyHashTable<String, String>

> does any one know the syntax for that ?

> what i actually mean is how do i set the generics

> data types in the inheritance mechanism ?

So, you want your MyHashTable to not be generic, but always be a Hashtable<String, String>? The syntax is the same as everywhere.

class MyHashtable extends Hashtable<String, String> {

}

Or do you want your MyHashtable to be generic, as in:

class MyHashtable<K, V> extends Hashtable<K, V> {

}

Lokoa at 2007-7-14 21:09:04 > top of Java-index,Java Essentials,Java Programming...
# 2
thanks man :-)it worked
kal.lizkora at 2007-7-14 21:09:04 > top of Java-index,Java Essentials,Java Programming...
# 3
This has a bad smell to it.Why are you extending hashtables at all? Delegation seems a more likely approach.
paulcwa at 2007-7-14 21:09:04 > top of Java-index,Java Essentials,Java Programming...