HashMap集合键是Student值是String的案例
2017-06-21 11:06
211 查看
/*
* 集合框架(HashMap集合键是Student值是String的案例) A:案例演示
* HashMap集合键是Student值是String的案例
* 键是学生对象,代表每一个学生
* 值是字符串对象,代表归属地
*
*/
HashMap<Student, String> hm =new HashMap<>();
hm.put(new Student("张三",23),"上海" );
hm.put(new Student("张三",23),"北京" );
hm.put(new Student("王五",23),"南京" );
hm.put(new Student("赵六",23),"无锡" );
System.out.println(hm);
* 集合框架(HashMap集合键是Student值是String的案例) A:案例演示
* HashMap集合键是Student值是String的案例
* 键是学生对象,代表每一个学生
* 值是字符串对象,代表归属地
*
*/
HashMap<Student, String> hm =new HashMap<>();
hm.put(new Student("张三",23),"上海" );
hm.put(new Student("张三",23),"北京" );
hm.put(new Student("王五",23),"南京" );
hm.put(new Student("赵六",23),"无锡" );
System.out.println(hm);
相关文章推荐
- Java基础知识强化之集合框架笔记56:Map集合之HashMap集合(HashMap<String,Student>)的案例
- Java基础知识强化之集合框架笔记57:Map集合之HashMap集合(HashMap<Student,String>)的案例
- 集合框架_HashMap集合键是String值是Student的案例
- 集合框架_HashMap集合键是Student值是String的案例
- Java_基础—TreeMap集合键是Student值是String的案例
- Java基础知识强化之集合框架笔记54:Map集合之HashMap集合(HashMap<String,String>)的案例
- 集合框架_HashMap集合键是Stirng值是String的案例
- Java基础知识强化之集合框架笔记55:Map集合之HashMap集合(HashMap<Integer,String>)的案例
- 集合框架_HashMap集合键是Integer值是String的案例
- TreeMap集合键是Student值是String的案例
- Java基础知识强化之集合框架笔记60:Map集合之TreeMap(TreeMap<Student,String>)的案例
- 集合框架_TreeMap集合键是Student值是String的案例
- 集合框架_HashMap集合嵌套ArrayList集合的案例
- JavaSE8基础 HashMap<Integer,String> containsKey/Value 判断集合是否包含指定的键或值
- 集合框架_ArrayList集合嵌套HashMap集合的案例
- JavaSE8基础 HashMap<Integer,String> entrySet遍历 键值对的集合
- 初始化集合的花样new HashMap<String, String>{ {put("str1":"abc");} }(转)
- 将List<Object[]>数组对象转换成List<HashMap<String, Object>>集合对象
- List<HashMap<String,Object>>集合类型进行键值内容排序!
- JavaSE8基础 HashMap<Integer,String> keySet values 获取所有键 所有值的集合