jdk1.8中使用

Set userDoneRecord =records.stream()

.filter(r -> r.getUserCode().equals(s.getUserCode())).map(StuJobRecord::getJobId).collect(

Collectors.toSet());



maps.forEach((k, v) -> {

//k 天 ,v作业

//等级分组

  Map> standGroup = v.stream()

.collect(Collectors.groupingBy(Job::getStandard));

//用户学完成的作业

  Set userNeedJobs = Optional.ofNullable(standGroup.get(s.getStandard()))

.orElseGet(ArrayList::new).stream().map(Job::getId).collect(Collectors.toSet());

if (userDoneRecord.containsAll(userNeedJobs)) {

jobByday.add(k);

}

});


List res = stuClassSchools.stream().map(s -> {

double totalSpend =records.stream().filter(

r -> r.getUserCode().equals(s.getUserCode()))

.map(consu)

.filter(r -> r !=null)

.reduce(0, (a, b) -> a + b).doubleValue();




int sumTime = questionList.stream().filter(x -> x.getExpectTimes() !=0 && x.getStandard().indexOf(a) != -1)

.mapToInt(QuestionJson::getExpectTimes).sum();


Map> maps = mapQue.stream().collect(Collectors.groupingBy(QuestionJson::getRefWord));

你可能感兴趣的:(jdk1.8中使用)