增加map.headMap测试样例

This commit is contained in:
LingZhaoHui 2023-12-29 21:35:10 +08:00
parent 0c5c96c90a
commit 3da2f133f9
Signed by: zeekling
GPG Key ID: D96E4E75267CA2CC

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"));
}
}