import java.util.*;

// Documentacion de la clase HashTable: https://docs.oracle.com/javase/8/docs/api/java/util/Hashtable.html

public class TestHashTable {

   public static void main (String [ ] Args) {

      Profesor p1 = new Profesor ("Juan", "Nadrie Garcia", 33, "Prof 22-387-11");
      Profesor p2 = new Profesor ("Pedro", "Nunes", 34, "Prof 22-243-45");
      Profesor p3 = new Profesor ("Mauro", "Ruiz perez", 36, "Prof 23-111-11");
      Medico m1 = new Medico ("Roberto", "Gonzalez García", 33, "Cirujano", "kjdkjhkjh");
      Medico m2 = new Medico ("Sofia", "Nunes", 34, "Cardiologo", "kjhkjhkjh");
      Medico m3 = new Medico ("Karla", "Ruiz Carrillo", 36, "Gereatra", "jhkjhkjh");



      Hashtable<String, Persona> htable = new Hashtable<String, Persona>();

      htable.put(p1.getNombre(), p1);
      htable.put(p2.getNombre(), p2);
      htable.put(p3.getNombre(), p3);
      htable.put(m1.getNombre(), m1);
      htable.put(m2.getNombre(), m2);
      htable.put(m3.getNombre(), m3);

      System.out.println("Tamano: " + htable.size());

      // Acceso mediante clase base
      Enumeration e = htable.keys();
      while (e.hasMoreElements()) {
         String key = (String) e.nextElement();
         Persona p = (Persona) htable.get(key);
         System.out.print(key + " : " + p.getNombre() + " --> ");
         p.visualiza();
      }
      System.out.println("");


      if (htable.containsKey("Pedro") == true) System.out.println("Hash table contiene a Pedro");
      if (htable.containsKey("Antonio") == false) System.out.println("Hash table NO contiene a Antonio");

   }

}