摘要: public static void main(String[] args) { LinkedList<Integer> integers = new LinkedList<>(); integers.add(1); integers.add(8); integers.add(1,3); for ( 阅读全文
posted @ 2021-02-23 23:56 枫叶像思念 阅读(2208) 评论(0) 推荐(0) 编辑
摘要: public static <T> void show(List<T> list){ for (T t : list) { System.out.print(t+" "); } } public static void main(String[] args) { ArrayList<Integer> 阅读全文
posted @ 2021-02-23 23:34 枫叶像思念 阅读(144) 评论(0) 推荐(0) 编辑
摘要: 1.Map接口 2.HashMap的遍历方式 (1)keySet()方法 通过map.keySet()方法 进行将所有的key变为一个集合set。然后通过遍历set集合(可以使用foreach或者迭代器) 得到每一个key 然后通过map.get(key)通过map得到value (2)entryS 阅读全文
posted @ 2021-02-23 21:06 枫叶像思念 阅读(237) 评论(0) 推荐(0) 编辑
摘要: 1.set子接口 特点“无下标、无序、不可重复。 2.实现set set是一个接口 所以不能使用new Set new的时候需要使用到set的两个实现类 hashSet、TreeSet 3.HashSet存储原理: 利用Object类里面的hashcode方法计算hash值。 如果hash值相等的话 阅读全文
posted @ 2021-02-23 17:25 枫叶像思念 阅读(78) 评论(0) 推荐(0) 编辑