How can this error be reported?
Explanation: If you use re.get() to retrieve the value in the following code, you will get an error, and you need to use re.isPresent() before using it.
to determine whether the value can be retrieved. The above problem will not occur.
all.forEach(a->{
Optional<WetListVO> re = reWetL.stream().
filter(b->b.getDate().equals( a.getDate())).findFirst();
if(re.isPresent()){
a.setResidentWetCount(re.get().getResidentWetCount());
a.setResidentWetNum(re.get().getResidentWetNum());
}
Optional<WetListVO> bu = buWetL.stream().
filter(b->b.getDate().equals(a.getDate())).findFirst();
if(bu.isPresent()){
a.setResidentBucketCount(bu.get().getResidentBucketCount());
a.setResidentBucketNum(bu.get().getResidentBucketNum());
}
}
Similar Posts:
- Java – Stream has already been operated upon or closed
- npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents
- [Solved] Spark Streaming:updateStateByKey is not applicable for the arguments…
- [Solved] DOM parsing XML Error: Content is not allowed in prolog
- Spring MVC: How to Solve Chinese garbled code Issue
- An error is reported when traversing the list collection to delete elements
- filter:progid:DXImageTransform.Microsoft.Gradient
- [Solved] mybatis Bulk Insert Error: Column count doesn‘t match value count at row 1
- [Solved] Raspberry pie raspivid creates a camera video stream Error: ES_OUT_SET_(GROUP_)PCR is called too late
- Failed to execute ‘createObjectURL’ on ‘URL’