Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Obligation {
- private String topic;
- private String status;
- private String comment;
- private String text;
- }
- public class ObligationStatus {
- private String topic;
- private String status;
- private String comment;
- }
- // this is what i have tried
- obList.stream().forEach(ob -> {
- osList.stream().forEach(os -> {
- if (ob.getTopic().equalsIgnoreCase(os.getTopic())) {
- ob.setStatus(os.getStatus());
- ob.setComment(os.getComment());
- }
- });
- });
- // also tried to do this without using forEach, but compilation error here
- List<Obligation> result = obList.stream()
- .map(ob -> osList.stream().map(os -> os.getTopic().equals(ob.getTopic())).collect(Function.identity()))
- .collect(Collectors.toList());
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement