diff options
author | Thomas <> | 2021-03-12 15:43:57 +0100 |
---|---|---|
committer | Thomas <> | 2021-03-12 15:43:57 +0100 |
commit | 7864448fd040b26b5921cfc63afa68ef2cb90c03 (patch) | |
tree | c2fdb77b4d3cbf02af1da0892ad1143983f3c3fa /eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/data | |
parent | 391bc8546bf5bc9a6396378ebec50a7e35031adc (diff) | |
download | EAAF-Components-7864448fd040b26b5921cfc63afa68ef2cb90c03.tar.gz EAAF-Components-7864448fd040b26b5921cfc63afa68ef2cb90c03.tar.bz2 EAAF-Components-7864448fd040b26b5921cfc63afa68ef2cb90c03.zip |
refactor some code to Java Stream API
Diffstat (limited to 'eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/data')
-rw-r--r-- | eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/data/AuthProcessDataWrapper.java | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/data/AuthProcessDataWrapper.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/data/AuthProcessDataWrapper.java index 8eef4a8e..368652be 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/data/AuthProcessDataWrapper.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/data/AuthProcessDataWrapper.java @@ -22,9 +22,11 @@ package at.gv.egiz.eaaf.core.impl.idp.auth.data; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; -import java.util.HashMap; import java.util.Map; +import java.util.Map.Entry; import java.util.TimeZone; +import java.util.stream.Collectors; +import java.util.stream.Stream; import javax.annotation.Nullable; @@ -264,16 +266,20 @@ public class AuthProcessDataWrapper * getGenericSessionDataStorage() */ @Override - public Map<String, Object> getGenericSessionDataStorage() { - final Map<String, Object> result = new HashMap<>(); - for (final Map.Entry<String, Object> el : authProcessData.entrySet()) { - if (el.getKey().startsWith(GENERIC_PREFIX)) { - result.put(el.getKey().substring(GENERIC_PREFIX.length()), el.getValue()); - } - - } - - return result; + public Map<String, Object> getGenericSessionDataStorage() { + return authProcessData.entrySet().stream() + .filter(el -> el.getKey().startsWith(GENERIC_PREFIX)) + .collect( + Collectors.toMap( + el -> el.getKey().substring(GENERIC_PREFIX.length()), + value -> value.getValue())); + + } + + @Override + public Stream<Entry<String, Object>> getGenericSessionDataStream() { + return getGenericSessionDataStorage().entrySet().stream(); + } /* |