Hashtable: values() : Hashtable « java.util « Java by API






Hashtable: values()

  



import java.util.Enumeration;
import java.util.Hashtable;

public class Main {
  public static void main(String[] s) {
    Hashtable<String,String> table = new Hashtable<String,String>();
    table.put("key1", "value1");
    table.put("key2", "value2");
    table.put("key3", "value3");

    Enumeration e = table.elements();
    while (e.hasMoreElements()) {
      String key = (String) e.nextElement();
      System.out.println(key + " : " + table.get(key));
    }

    System.out.println(table.values());
  }
}

   
    
  








Related examples in the same category

1.new Hashtable()
2.new Hashtable < K, V > ()
3.Hashtable: clear()
4.Hashtable: clone()
5.Hashtable: contains(Object value)
6.Hashtable: containsKey(Object key)
7.Hashtable: elements()
8.Hashtable: entrySet()
9.Hashtable: get(E e)
10.Hashtable: isEmpty()
11.Hashtable: iterator()
12.Hashtable: keySet()
13.Hashtable: keys()
14.Hashtable: put(K key, V value)
15.Hashtable: putAll(Map t)
16.Hashtable: remove(Object key)
17.Hashtable: size()