提示:您可在线编辑运行本教程的实例 - 运行实例,去试试!
从TreeMap获取子地图
import java.util.TreeMap; import java.util.SortedMap;//来自 nowjava.com - 时代Java public class Main { public static void main(String[] args) { TreeMap treeMap = new TreeMap(); treeMap.put("1","One"); treeMap.put("3","Three"); treeMap.put("2","Two"); treeMap.put("5","Five"); treeMap.put("4","Four"); SortedMap sortedMap = treeMap.subMap("2",