Java mendapatkan kunci dari peta pohon
package com.java2novice.treemap;
import java.util.Set;
import java.util.TreeMap;
public class MyTreeMapKeys {
public static void main(String a[]){
TreeMap<String, String> hm = new TreeMap<String, String>();
//add key-value pair to TreeMap
hm.put("first", "FIRST INSERTED");
hm.put("second", "SECOND INSERTED");
hm.put("third","THIRD INSERTED");
System.out.println(hm);
Set<String> keys = hm.keySet();
for(String key: keys){
System.out.println(key);
}
}
}
Collin Strait