It is the path you have chosen. Take pride in it. Kotomine Kirei

小小星河

危楼高百尺 , 手可摘星辰

项目后续-日常应用代码记录

一、代码实现

1.数组转换成List

String[] deviceIdAy = buildingDto.getChannelId().split(Symbol.COMMA);
//设备id
List<String> deviceIdList = Arrays.asList(deviceIdAy);

2.List转换成数组

List<String> gatemateIdList = buildingDao.listBuildingDeviceId(buildingDeviceCond);
String[] deviceIdAy = gatemateIdList.toArray(new String[gatemateIdList.size()]);

3.List数组拼接到另外一个List后面(channelDtoListTo放到channelDtoList后面)

List<ChannelDTO> channelDtoListTo = buildingDao.listChannel(channelCondTo);
channelDtoListTo.stream().sequential().collect(Collectors.toCollection(() -> channelDtoList));

3.List的stream的用法

1.map 用来对list中的单独对象进行全体修改然后返回一个list回来
Set<String> roleList = roles.stream().map(role -> "ROLE_" + role.toUpperCase()).collect(Collectors.toSet());
1.filter 用来过滤符合条件的数据,然后返回一个list
selfStudyClassroomDtoList = selfStudyClassroomDtoList.stream().filter(s -> s.getWeekDay().equals(w)).collect(Collectors.toList());


posted on 2020-04-28 21:27  小小星河  阅读(258)  评论(0编辑  收藏  举报

导航