当前位置: 首页 > wzjs >正文

济南网站建设咨询小七广告营销包括哪些方面

济南网站建设咨询小七,广告营销包括哪些方面,quibids 网站建设,博物馆wordpress主体写在前面的话&#xff1a;减少strean流操作&#xff0c;减少多层嵌套for循环。使用普通for循环和map的方式进行转换&#xff0c; 第一步查询数据 List<Student> findList studentDao.findList(findMap); 第二步准备遍历和赋值 if(CollectionUtil.isNotEmpty(findLis…

写在前面的话:减少strean流操作,减少多层嵌套for循环。使用普通for循环和map的方式进行转换,

第一步查询数据

List<Student> findList = studentDao.findList(findMap);

第二步准备遍历和赋值

if(CollectionUtil.isNotEmpty(findList)){// 第一次遍历,取出所有待翻译的字段,避免重复使用steam流取值Set<String> courseSet = new HashSet<>(16);Set<String> schooldSet = new HashSet<>(16);Set<String> nativePlaceSet = new HashSet<>(16);for (Student student : findList) {// 课程idString courseId = student.getSourceId();if(StringUtil.isNotEmpty(courseId)){courseSet.add(courseId);}// 学校idString schooldId = student.getSchoold();if(StringUtil.isNotEmpty(schooldId)){schooldSet.add(schooldId);}// 籍贯idString nativePlaceId = student.getNativePlace();if(StringUtil.isNotEmpty(nativePlaceId)){nativePlaceSet.add(nativePlaceId);}}// 查询课程信息、学校信息、籍贯信息,并转换成mapMap<String,Object> findMap = new HashMap<>(16);findMap.put("courseSet",courseSet);findMap.put("schooldSet",schooldSet);findMap.put("nativePlaceSet",nativePlaceSet);List<Course> courseList = courseDao.findList(findMap);List<Schoold> schooldList = schooldDao.findList(findMap);List<NativePlace> nativePlaceList = nativePlaceDao.findList(findMap);// 转换成mapMap<String,Course> courseMap = CollectionUtil.isEmpty(courseList) ? new HashMap<>(0) :courseList.stream().collect(Collectors.toMap(Course::getId, course -> course));Map<String,Schoold> schooldMap = CollectionUtil.isEmpty(schooldList) ? new HashMap<>(0) :courseList.stream().collect(Collectors.toMap(Schoold::getId, schoold -> schoold));Map<String,NativePlace> nativePlaceMap = CollectionUtil.isEmpty(nativePlaceList) ? new HashMap<>(0) :courseList.stream().collect(Collectors.toMap(NativePlace::getId, nativePlace -> nativePlace));// 第二次遍历,填充翻译后的值for (Student student : findList) {// 课程id-->课程名称String courseId = student.getSourceId();if(StringUtil.isNotEmpty(courseId)){student.setSourceName(courseMap.get(courseId).getName());}// 学校id-->学校名称String schooldId = student.getSchoold();if(StringUtil.isNotEmpty(schooldId)){student.setSchooldName(schooldMap.get(schooldId).getName());}// 籍贯id-->籍贯名称String nativePlaceId = student.getNativePlace();if(StringUtil.isNotEmpty(nativePlaceId)){student.setNativePlaceName(nativePlaceMap.get(nativePlaceId).getName());}}}

结语:仅遍历2次,减少了stream流取值。用转map的方式减少了多层for循环。

http://www.dtcms.com/wzjs/59924.html

相关文章:

  • 安卓应用开发软件大连seo
  • 专业网站建设怎么样网址查询网站
  • 专门做进口产品的网站什么叫seo优化
  • dw个人网站制作网站推广方法有哪些
  • 免费做网站建设制作网站需要什么技术
  • 美国做垂直电商的网站淘宝指数查询官网
  • 做网站聊城如何做网站推广
  • 国内网站推广关键词广告
  • 帮朋友做网站的坑郑州整站关键词搜索排名技术
  • 怎么做律所的官方网站谷歌google官方下载
  • seo北京网站推广太原网站制作优化seo公司
  • 网站建设样式百度竞价排名机制
  • 福州公司网站建设上海关键词排名提升
  • 餐饮网站设计南昌seo全网营销
  • 当今做那些网站致富网络营销毕业论文范文
  • 厦门易尔通网站建设好吗seo薪酬
  • 有多少做汽车的网站seo收索引擎优化
  • 公司网站建设开发济南兴田德润优惠吗网络推广的好处
  • 深圳手机网站制作公司百度指数明星搜索排名
  • 手表网站妨水移动网站推广如何优化
  • 瑞安做网站建设哪家好广西百度seo
  • 国家企业信用信息公示系统贵州seo顾问什么职位
  • 做网站前期ps 图多大营销对企业的重要性
  • 做图片网站 解决版权深圳谷歌seo推广
  • 做微信平台网站需要多少钱抖音引流推广一个30元
  • 网站中的表格网站seo运营培训机构
  • 代理做网站的合同大连头条热点新闻
  • 徐州网站开发信息今日国内新闻大事20条
  • 建个电子商务网站多少钱百度收录量
  • 谁有手机网站啊介绍一下百度一下知道官网