java基础
beileye741
这个作者很懒,什么都没留下…
展开
-
Collection 集合
一、创建User CollectionT类 public class CollectionT { public static void main(String[] args) { Collection col = new Vector(); User u1 = new User(); u1.setAge(1); u1.setName("zhangsan"); User u2原创 2017-10-29 23:25:35 · 211 阅读 · 0 评论 -
HashMap 用法
HashMap获取k,v方法 public class MapT { public static void main(String[] args) { Map map = new HashMap map.put("zhangsan", 1); map.put("lisi",2); map.put("wangwu", 3); map.put("zhaoliu", 4); Syst原创 2017-10-30 00:12:09 · 224 阅读 · 0 评论 -
TreeMap用法
TreeSet 用法 一、需要实现 Comparable接口,否则比较大小时编译会出错 public class TreeSetT { public static void main(String[] args) { TreeSet set = new TreeSet(); set.add(-5); set.add(1); set.add(5); set.add(4); set.原创 2017-10-31 00:20:01 · 347 阅读 · 0 评论 -
文章标题
TreeMap用法“` public class TreeMapT { public static void main(String[] args) { //treeMap默认升序 K不重复 匿名内部类重写compare方法改变排序方式(降序) TreeMap<String,Integer> m = new TreeMap(new Comparator<Str原创 2017-10-31 23:05:07 · 131 阅读 · 0 评论