![](https://img-blog.csdnimg.cn/20201014180756738.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
HashMap
凌霄殿的大帝
这个作者很懒,什么都没留下…
展开
-
HashMap介绍
@Test public void add(){ Map<String,Integer> map=new HashMap<>(); map.put("张三",21); map.put("李四",23); map.put("王五",24); map.put("赵六",20);原创 2018-11-10 20:57:24 · 93 阅读 · 0 评论 -
LinkedHashSet简单实例
创建随机数,且不能重复,用Set集合 //创建随机数,且不能重复,用Set集合 @Test public void getNumber(){ Random random=new Random(); HashSet<Integer> hashSet=new HashSet<>(); while (ha...原创 2018-11-10 20:59:41 · 277 阅读 · 0 评论 -
HashMap
判断输入字符串中字符与出现次数 //判断输入字符串中字符与出现次数 @Test public void check(){ String str="aasssddddd"; char[] chars=str.toCharArray(); HashMap<Character,Integer> hashMap=ne...原创 2018-11-10 21:11:45 · 152 阅读 · 0 评论 -
单列集合Collection和双列集合 Map实现扑克牌游戏
@Test public void pokerGame(){ String[] num={"3","4","5","6","7","8","9","10","J","Q","K","A","2"}; S转载 2018-11-10 22:38:31 · 6138 阅读 · 0 评论 -
Collection和Map
Collection List(存取有序,有索引,可以重复) ArrayList LinkedList Vector Set(存取无序,无索引,不可以重复) HashSet(开发时较多,效率较高) 底层是哈希算法实现 LinkedHashSet 底层是链表实现,但也可以保证元素唯一,和HashSet原理一样 TreeSe...原创 2018-11-10 23:28:43 · 71 阅读 · 0 评论