Java中TreeMap使用演示代码
import java.util.TreeMap; public class dimensionsExample { public static void main(String[] args) { TreeMap<String,String> dimensions = new TreeMap<String,String>(); dimensions.put("NC", "2333"); dimensions.put("NY", "2334"); dimensions.put("SC", "2335"); dimensions.put("CA", "2336"); System.out.println("CA: " + dimensions.get("CA")); dimensions.put("AZ", "2337"); System.out.println("Size of dimensions: " + dimensions.size()); dimensions.remove("SC"); System.out.println("Size of dimensions: " + dimensions.size()); } }