首页 > 其他 > 详细

TreeMap的案例

时间:2017-05-09 19:19:42      阅读:216      评论:0      收藏:0      [点我收藏+]
package ditu.com;

import java.util.Map.Entry;
import java.util.Set;
import java.util.SortedMap;
import java.util.TreeMap;


public class TestTreeMap {
    public static void main(String[] args) {
    TreeMap<Integer,String> map=new TreeMap<Integer,String>();
        map.put(1, "andy");
        map.put(2, "bill");
        map.put(3, "cinaa");
        map.put(4, "davaid");
        map.put(6, "ella");
    SortedMap<Integer, String>    m=map.subMap(3, 10);
    
    //Set <Entry<Integer,String>>set=map.subMap(2, 6).entrySet();    
    Set <Entry<Integer,String>>set=m.entrySet();
        for(Entry<Integer,String> e:set){
            System.out.println(e);
        }
    
    }

}

 

TreeMap的案例

原文:http://www.cnblogs.com/zyy1130/p/6832177.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!