java.util.HashMap.keySet() 方法


java.util.HashMap.keySet() 方法

package com.codingdict;

import java.util.*;

public class HashMapDemo {
   public static void main(String args[]) {

      // create hash map
      HashMap newmap = new HashMap();

      // populate hash map
      newmap.put(1, "tutorials");
      newmap.put(2, "point");
      newmap.put(3, "is best");

      // get keyset value from map
      Set keyset = newmap.keySet();

      // check key set values
      System.out.println("Key set values are: " + keyset);
   }    
}