KEYCLOAK-11983 Use diamond operator for collections in module core

This commit is contained in:
Andrei Arlou 2019-11-02 18:14:28 +03:00 committed by Stian Thorgersen
parent 7c295c1d43
commit 5ff0da319a
13 changed files with 19 additions and 19 deletions

View file

@ -48,7 +48,7 @@ public class AccessToken extends IDToken {
Access access = new Access();
access.verifyCaller = verifyCaller;
if (roles != null) {
access.roles = new HashSet<String>();
access.roles = new HashSet<>();
access.roles.addAll(roles);
}
return access;
@ -70,7 +70,7 @@ public class AccessToken extends IDToken {
}
public Access addRole(String role) {
if (roles == null) roles = new HashSet<String>();
if (roles == null) roles = new HashSet<>();
roles.add(role);
return this;
}

View file

@ -55,7 +55,7 @@ public class AccessTokenResponse {
@JsonProperty("session_state")
protected String sessionState;
protected Map<String, Object> otherClaims = new HashMap<String, Object>();
protected Map<String, Object> otherClaims = new HashMap<>();
// OIDC Financial API Read Only Profile : scope MUST be returned in the response from Token Endpoint
@JsonProperty("scope")

View file

@ -52,7 +52,7 @@ public class RefreshToken extends AccessToken {
realmAccess = token.realmAccess.clone();
}
if (token.resourceAccess != null) {
resourceAccess = new HashMap<String, Access>();
resourceAccess = new HashMap<>();
for (Map.Entry<String, Access> entry : token.resourceAccess.entrySet()) {
resourceAccess.put(entry.getKey(), entry.getValue().clone());
}

View file

@ -32,28 +32,28 @@ public class GlobalRequestResult {
public void addSuccessRequest(String reqUri) {
if (successRequests == null) {
successRequests = new ArrayList<String>();
successRequests = new ArrayList<>();
}
successRequests.add(reqUri);
}
public void addFailedRequest(String reqUri) {
if (failedRequests == null) {
failedRequests = new ArrayList<String>();
failedRequests = new ArrayList<>();
}
failedRequests.add(reqUri);
}
public void addAllSuccessRequests(List<String> reqUris) {
if (successRequests == null) {
successRequests = new ArrayList<String>();
successRequests = new ArrayList<>();
}
successRequests.addAll(reqUris);
}
public void addAllFailedRequests(List<String> reqUris) {
if (failedRequests == null) {
failedRequests = new ArrayList<String>();
failedRequests = new ArrayList<>();
}
failedRequests.addAll(reqUris);
}

View file

@ -29,7 +29,7 @@ public class AuthenticatorConfigRepresentation implements Serializable {
private String id;
private String alias;
private Map<String, String> config = new HashMap<String, String>();
private Map<String, String> config = new HashMap<>();
public String getId() {
return id;

View file

@ -29,7 +29,7 @@ public class IdentityProviderMapperRepresentation {
protected String name;
protected String identityProviderAlias;
protected String identityProviderMapper;
protected Map<String, String> config = new HashMap<String, String>();
protected Map<String, String> config = new HashMap<>();
public String getId() {

View file

@ -56,7 +56,7 @@ public class IdentityProviderRepresentation {
protected boolean linkOnly;
protected String firstBrokerLoginFlowAlias;
protected String postBrokerLoginFlowAlias;
protected Map<String, String> config = new HashMap<String, String>();
protected Map<String, String> config = new HashMap<>();
public String getInternalId() {
return this.internalId;

View file

@ -35,7 +35,7 @@ public class ProtocolMapperRepresentation {
@Deprecated // backwards compatibility only
protected String consentText;
protected Map<String, String> config = new HashMap<String, String>();
protected Map<String, String> config = new HashMap<>();
public String getId() {

View file

@ -227,7 +227,7 @@ public class RealmRepresentation {
public UserRepresentation user(String username) {
UserRepresentation user = new UserRepresentation();
user.setUsername(username);
if (users == null) users = new ArrayList<UserRepresentation>();
if (users == null) users = new ArrayList<>();
users.add(user);
return user;
}
@ -360,7 +360,7 @@ public class RealmRepresentation {
public ScopeMappingRepresentation clientScopeMapping(String clientName) {
ScopeMappingRepresentation mapping = new ScopeMappingRepresentation();
mapping.setClient(clientName);
if (scopeMappings == null) scopeMappings = new ArrayList<ScopeMappingRepresentation>();
if (scopeMappings == null) scopeMappings = new ArrayList<>();
scopeMappings.add(mapping);
return mapping;
}
@ -368,7 +368,7 @@ public class RealmRepresentation {
public ScopeMappingRepresentation clientScopeScopeMapping(String clientScopeName) {
ScopeMappingRepresentation mapping = new ScopeMappingRepresentation();
mapping.setClientScope(clientScopeName);
if (scopeMappings == null) scopeMappings = new ArrayList<ScopeMappingRepresentation>();
if (scopeMappings == null) scopeMappings = new ArrayList<>();
scopeMappings.add(mapping);
return mapping;
}

View file

@ -32,7 +32,7 @@ public class RequiredActionProviderRepresentation {
private boolean enabled;
private boolean defaultAction;
private int priority;
private Map<String, String> config = new HashMap<String, String>();
private Map<String, String> config = new HashMap<>();
public String getAlias() {

View file

@ -71,7 +71,7 @@ public class ScopeMappingRepresentation {
}
public ScopeMappingRepresentation role(String role) {
if (this.roles == null) this.roles = new HashSet<String>();
if (this.roles == null) this.roles = new HashSet<>();
this.roles.add(role);
return this;
}

View file

@ -31,7 +31,7 @@ public class UserSessionRepresentation {
private String ipAddress;
private long start;
private long lastAccess;
private Map<String, String> clients = new HashMap<String, String>();
private Map<String, String> clients = new HashMap<>();
public String getId() {
return id;

View file

@ -43,7 +43,7 @@ public class PermissionRequest {
public PermissionRequest(String resourceId, String... scopes) {
this.resourceId = resourceId;
if (scopes != null) {
this.scopes = new HashSet(Arrays.asList(scopes));
this.scopes = new HashSet<>(Arrays.asList(scopes));
}
}