Teniendo un HashMap de este tipo
HashMapht = new HashMap ();
podemos utilizar un FOREACH para recorrer un HaspMap, para ellos haremos uso de Map.Entry, quedaría de la siguiente manera
for (Map.Entryelemento : ht.entrySet()) {
System.out.println(elemento.getKey() + " _ " + elemento.getValue());
}
No hay comentarios:
Publicar un comentario