Close stream
This commit is contained in:
parent
54a2f10114
commit
51d4837c19
1 changed files with 8 additions and 4 deletions
|
@ -41,10 +41,14 @@ public class GroupScimService extends AbstractScimService<GroupModel, Group> {
|
|||
Set<String> names = new TreeSet<>();
|
||||
resource.getId().ifPresent(names::add);
|
||||
resource.getDisplayName().ifPresent(names::add);
|
||||
Optional<GroupModel> group = getKeycloakDao().getGroupsStream()
|
||||
.filter(groupModel -> names.contains(groupModel.getName()))
|
||||
.findFirst();
|
||||
return group.map(GroupModel::getId).map(KeycloakId::new);
|
||||
try (Stream<GroupModel> groupsStream = getKeycloakDao().getGroupsStream()) {
|
||||
Optional<GroupModel> group = groupsStream
|
||||
.filter(groupModel -> names.contains(groupModel.getName()))
|
||||
.findFirst();
|
||||
return group
|
||||
.map(GroupModel::getId)
|
||||
.map(KeycloakId::new);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue