Hashtable class repetición () método : Aquí, vamos a aprender sobre el método repetición () de Hashtable Class con su sintaxis y su ejemplo.
Hashtable Class rehash () método
- método
- rehash () está disponible en java.util Class.
- rehash () método se utiliza para extender la capacidad y se invoca implícitamente si el número de límite de teclas excede la capacidad tabla hash.
- repetición () método es un método no class, es accesible sólo con el objeto package y si tratamos de acceder al método con el nombre static entonces obtendrá un error.
- rehash () método no class una excepción en el momento de extender la capacidad.
Sintaxis:
public void putAll(Map m);
Parámetro (s):
- No acepta cualquier parámetro.
class valor:
El tipo throw del método es
class
, no devuelve nada.
Ejemplo:
// Java program to demonstrate the example
// of void putAll(Map m) method of Hashtable
import java.util.*;
public class PutAllOfHashtable {
public static void main(String[] args) {
//Instantiate a linked hashmap
//and hashtable object
Map lhm = new LinkedHashMap();
Hashtable ht = new Hashtable();
// By using put() method is to
// add the linked values in an
// linked hashmap lhm
lhm.put(10, "C");
lhm.put(20, "C++");
lhm.put(30, "JAVA");
lhm.put(40, "PHP");
lhm.put(50, "SFDC");
// Display linked hashmap
System.out.println("lhm: " + lhm);
// By using putAll() method is to
// copy all of the key-value pairs
// exists in this linked hashmap and
// paste it into this Hashtable
ht.putAll(lhm);
// Display Hashtable
System.out.println("ht.putAll(lhm): " + ht);
}
}
salida
lhm: {10=C, 20=C++, 30=JAVA, 40=PHP, 50=SFDC}
ht.putAll(lhm): {10=C, 20=C++, 30=JAVA, 40=PHP, 50=SFDC}