Add method to create one hashtable from a map, useful in converting a

HashMap into a Hashtable.
This commit is contained in:
Eric Scharff 2007-12-18 11:23:59 -07:00
parent 3bafbf08bb
commit 8b2577b77c

View File

@ -11,6 +11,13 @@ public class Hashtable<K, V> implements Map<K, V> {
this(0);
}
public Hashtable(Map<? extends K,? extends V> m) {
this(m.size());
for (Entry<? extends K, ? extends V> entry : m.entrySet()) {
put(entry.getKey(), entry.getValue());
}
}
public String toString() {
return map.toString();
}