Use diamond operator when possible

This commit is contained in:
Brendan Le Ny 2024-06-12 14:49:28 +02:00
parent 2782beafe6
commit 26dc5edba2
3 changed files with 5 additions and 5 deletions

View file

@ -20,7 +20,7 @@ import java.util.stream.Stream;
public class GroupAdapter extends Adapter<GroupModel, Group> { public class GroupAdapter extends Adapter<GroupModel, Group> {
private String displayName; private String displayName;
private Set<String> members = new HashSet<String>(); private Set<String> members = new HashSet<>();
public GroupAdapter(KeycloakSession session, String componentId) { public GroupAdapter(KeycloakSession session, String componentId) {
super(session, componentId, "Group", Logger.getLogger(GroupAdapter.class)); super(session, componentId, "Group", Logger.getLogger(GroupAdapter.class));
@ -58,7 +58,7 @@ public class GroupAdapter extends Adapter<GroupModel, Group> {
setDisplayName(group.getDisplayName().get()); setDisplayName(group.getDisplayName().get());
var groupMembers = group.getMembers(); var groupMembers = group.getMembers();
if (groupMembers != null && groupMembers.size() > 0) { if (groupMembers != null && groupMembers.size() > 0) {
this.members = new HashSet<String>(); this.members = new HashSet<>();
for (var groupMember : groupMembers) { for (var groupMember : groupMembers) {
try { try {
var userMapping = this.query("findByExternalId", groupMember.getValue().get(), "User") var userMapping = this.query("findByExternalId", groupMember.getValue().get(), "User")

View file

@ -169,7 +169,7 @@ public class UserAdapter extends Adapter<UserModel, User> {
logger.warn(e); logger.warn(e);
} }
user.setMeta(meta); user.setMeta(meta);
List<PersonRole> roles = new ArrayList<PersonRole>(); List<PersonRole> roles = new ArrayList<>();
for (var r : this.roles) { for (var r : this.roles) {
var role = new PersonRole(); var role = new PersonRole();
role.setValue(r); role.setValue(r);
@ -227,7 +227,7 @@ public class UserAdapter extends Adapter<UserModel, User> {
@Override @Override
public Stream<UserModel> getResourceStream() { public Stream<UserModel> getResourceStream() {
Map<String, String> params = new HashMap<String, String>() { Map<String, String> params = new HashMap<>() {
}; };
return this.session.users().searchForUserStream(realm, params); return this.session.users().searchForUserStream(realm, params);
} }

View file

@ -28,7 +28,7 @@ public class ScimEventListenerProvider implements EventListenerProvider {
private final KeycloakSession session; private final KeycloakSession session;
private final Map<ResourceType, Pattern> patterns = new HashMap<ResourceType, Pattern>(); private final Map<ResourceType, Pattern> patterns = new HashMap<>();
public ScimEventListenerProvider(KeycloakSession session) { public ScimEventListenerProvider(KeycloakSession session) {
this.session = session; this.session = session;