项目中使用java8的两个小特性

java8获取两个Integer集合的和

 List<Integer> sumList = IntStream.range(0, planList.size()).map(i->planList.get(i)+samplingList.get(i)).boxed()
                 .collect(Collectors.toList());

java8获取当前月份的天数

		ArrayList<QcSecurityVo> list = new ArrayList<QcSecurityVo>();
		LocalDate date = LocalDate.of(2019, 2, 1);
		int month =2;
		while(date.getMonthValue() == month) {
			QcSecurityVo vo = new QcSecurityVo();
			vo.setMonth(date.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
			System.out.println(vo.getMonth());
			list.add(vo);
			
			date = date.plusDays(1);
		}
已标记关键词 清除标记
©️2020 CSDN 皮肤主题: 博客之星2020 设计师:CY__0809 返回首页