码迷,mamicode.com
首页 > 其他好文 > 详细

14.7.3

时间:2015-10-16 23:16:31      阅读:173      评论:0      收藏:0      [点我收藏+]

标签:

package jihe;

public class Emp {
    private String Id;
    private String Name;
    public Emp(String id, String name)
    {
        Id = id;
        Name = name;
    }
    public String Iemp()
    {
        return Id;
    }
    public String Emp()
    {
        return Name;
    }
}
        //14.7.3
        Emp our1 = new Emp("012", "哈哈");
        Emp our2 = new Emp("013", "呵呵");
        Emp our3 = new Emp("014", "嘿嘿");
        Emp our4 = new Emp("015", "哼哼");
        Emp our5 = new Emp("016", "呼呼");
        TreeMap<String, String> stu = new TreeMap<>();
        stu.put(our1.Iemp(), our1.Emp());
        stu.put(our2.Iemp(), our2.Emp());
        stu.put(our3.Iemp(), our3.Emp());
        stu.put(our4.Iemp(), our4.Emp());
        stu.put(our5.Iemp(), our5.Emp());
        Set<String> t = stu.keySet();
        for(String s : t)
        {
            System.out.println(s+stu.get(s));
        }
        System.out.println();
        stu.remove("015");
        Set<String> ct = stu.keySet();
        for(String s : t)
        {
            System.out.println(s+stu.get(s));
        }

技术分享

14.7.3

标签:

原文地址:http://www.cnblogs.com/wgbs25673578/p/4886547.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!