Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2019
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. public class Obligation {
  2. private String topic;
  3. private String status;
  4. private String comment;
  5. private String text;
  6. }
  7.  
  8. public class ObligationStatus {
  9.  
  10. private String topic;
  11. private String status;
  12. private String comment;
  13. }
  14.  
  15. // this is what i have tried
  16. obList.stream().forEach(ob -> {
  17. osList.stream().forEach(os -> {
  18. if (ob.getTopic().equalsIgnoreCase(os.getTopic())) {
  19. ob.setStatus(os.getStatus());
  20. ob.setComment(os.getComment());
  21. }
  22. });
  23. });
  24.  
  25. // also tried to do this without using forEach, but compilation error here
  26. List<Obligation> result = obList.stream()
  27. .map(ob -> osList.stream().map(os -> os.getTopic().equals(ob.getTopic())).collect(Function.identity()))
  28. .collect(Collectors.toList());
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement