增加map.headMap测试样例 #4

Merged
zeekling merged 1 commits from headmap into main 2023-12-29 13:35:38 +00:00

View File

@ -0,0 +1,19 @@
package com.zeekling.cn.map.sortedmap;
import java.util.SortedMap;
import java.util.TreeMap;
public class HeadMap {
public static void main(String[] args) {
SortedMap<String, String> mp = new TreeMap<>();
mp.put("One", "Geeks");
mp.put("Two", "For");
mp.put("Three", "Geeks");
mp.put("Four", "Code");
mp.put("Five", "It");
// 返回键小于H的映射
System.out.print(mp.headMap("H"));
}
}