小编sac*_*inr的帖子

从键值对开始迭代Java中的Map(特别是TreeMap)

我有一个TreeMap,我想迭代它并打印键值对.但我不想从头开始,我想从一个特定的键值对开始.

基本上我想这样做 -

TreeMap<String, String> treeMap = new TreeMap<String, String>();
//Populate it here
treeMap.get("key1");
//get the iterator to the treemap starting from the key1-value1 pair and iterate
Run Code Online (Sandbox Code Playgroud)

如果我想从头到尾迭代,我知道如何做到这一点,但我没有找到任何答案.

java treemap

3
推荐指数
1
解决办法
1688
查看次数

标签 统计

java ×1

treemap ×1