List Map互相转换习题1
List Map互相转换习题1
5、实现List和Map数据的转换。具体要求如下:
功能1:定义方法public void listToMap( ){ }将List中Student元素封装到Map中
1)使用构造方法Student(int id,String name,int age,String sex )创建多个学生信息并加入List
2)遍历List,输出每个Student信息
3)将List中数据放入Map,使用Student的id属性作为key,使用Student对象信息作为value
4)遍历M
原创
2020-09-09 18:02:17 ·
404 阅读 ·
0 评论