Advertisement
Guest User

Untitled

a guest
Mar 25th, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.70 KB | None | 0 0
  1.  List<Section> finalSections = new ArrayList<>();
  2.         Language languageToSave = languageFormMapper.toEntity(languageDto);
  3.         List<Section> sections = findSections(languageDto.getSectionIds());
  4.         List<Long> validSectionIds = sections.stream().map(Section::getId).collect(toList());
  5.  
  6.         languageDto.getSectionIds().forEach(id -> {
  7.             if (validSectionIds.contains(id)) {
  8.                 sections.stream().filter(section -> section.getId().equals(id)).forEach(finalSections::add);
  9.             }
  10.         });
  11.  
  12. //        for (Section section : sections) {
  13. //            if (section.getId().equals(id)) {
  14. //                finalSections.add(section);
  15. //            }
  16. //        }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement