I have the following method:
public MenuExpandedDTO findMenuExp(UUID menuUuid) {
final MenuDTO menu = menuService.findByUuid(menuUuid);
final MenuPropertiesDTO propertiesDTO = new MenuPropertiesDTO(
menu.getUuid(),
menu.getName()
);
final List<GroupExpDTO> groups = menuGroupService
.findAllByMenuUuid(menuUuid).stream()
.map(menuGroup -> {
UUID groupUuid = menuGroup.getGroupUuid();
return findGroupExp(groupUuid);
})
.collect(Collectors.toList());
return new MenuExpDTO(propertiesDTO, groups, null, null);
}
In this method, I pass a single menuUuid
and then get combination of a single MenuPropertiesDTO
and List<GroupExpDTO>
.
I want to pass a List<menuUuid>
instead of a single menuUuid
and then get the result according to the uuids in this list. However, I am confused if there is a proper way for this in Java. I think there is no need to use loop and it would be possible to evaluate this using stream
. But have really no idea how to construct it or if it is possible. Any help would be appreciated.