增加map.headMap测试样例
This commit is contained in:
parent
0c5c96c90a
commit
3da2f133f9
19
src/main/java/com/zeekling/cn/map/sortedmap/HeadMap.java
Normal file
19
src/main/java/com/zeekling/cn/map/sortedmap/HeadMap.java
Normal 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"));
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user