[java-identity-provider] 01/02: IDP-1121 Simplify typing for IdPAttributeValue

Rod Widdowson rdw at steadingsoftware.com
Wed Apr 24 11:55:39 EDT 2019


This is an automated email from the git hooks/post-receive script.

rdw pushed a commit to branch master
in repository java-identity-provider.

View the commit online:
http://git.shibboleth.net/view/?p=java-identity-provider.git;a=commit;h=4b1481fdbbd68be8027d3e0492adb9acd8faaee9

commit 4b1481fdbbd68be8027d3e0492adb9acd8faaee9
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Wed Apr 24 15:52:18 2019 +0100

    IDP-1121 Simplify typing for IdPAttributeValue
    
    https://issues.shibboleth.net/jira/browse/IDP-1121
    
    A better way to generate the unmodifiable list (with thanks to Daniel)
---
 .../src/main/java/net/shibboleth/idp/attribute/IdPAttribute.java     | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/idp-attribute-api/src/main/java/net/shibboleth/idp/attribute/IdPAttribute.java b/idp-attribute-api/src/main/java/net/shibboleth/idp/attribute/IdPAttribute.java
index 97cbfe4..3825d4f 100644
--- a/idp-attribute-api/src/main/java/net/shibboleth/idp/attribute/IdPAttribute.java
+++ b/idp-attribute-api/src/main/java/net/shibboleth/idp/attribute/IdPAttribute.java
@@ -24,6 +24,7 @@ import java.util.Locale;
 import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Set;
+import java.util.stream.Collectors;
 
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
@@ -174,9 +175,9 @@ public class IdPAttribute implements Comparable<IdPAttribute>, Cloneable {
      */
     public void setValues(@Nullable @NullableElements final Collection<IdPAttributeValue<?>> newValues) {
         if (newValues != null) {
-            values = List.of(newValues.stream().
+            values = newValues.stream().
                      map(e -> e==null? new EmptyAttributeValue(EmptyType.NULL_VALUE) :e).
-                     toArray(IdPAttributeValue<?>[]::new));
+                     collect(Collectors.collectingAndThen(Collectors.toList(), Collections::unmodifiableList));
         } else {
             values = List.of();
         }

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list