← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 20333: minor fix, use j8 lambdas in Schema class

 

------------------------------------------------------------
revno: 20333
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2015-09-24 10:20:17 +0700
message:
  minor fix, use j8 lambdas in Schema class
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/Schema.java


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/Schema.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/Schema.java	2015-09-23 10:48:14 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/Schema.java	2015-09-24 03:20:17 +0000
@@ -447,7 +447,7 @@
     @JsonProperty
     @JacksonXmlElementWrapper( localName = "references", namespace = DxfNamespaces.DXF_2_0 )
     @JacksonXmlProperty( localName = "reference", namespace = DxfNamespaces.DXF_2_0 )
-    @SuppressWarnings("rawtypes")
+    @SuppressWarnings( "rawtypes" )
     public Set<Class> getReferences()
     {
         return getProperties().stream()
@@ -461,13 +461,8 @@
         {
             persistedProperties = new HashMap<>();
 
-            for ( Map.Entry<String, Property> entry : getPropertyMap().entrySet() )
-            {
-                if ( entry.getValue().isPersisted() )
-                {
-                    persistedProperties.put( entry.getKey(), entry.getValue() );
-                }
-            }
+            getPropertyMap().entrySet().stream().filter( entry -> entry.getValue().isPersisted() )
+                .forEach( entry -> persistedProperties.put( entry.getKey(), entry.getValue() ) );
         }
 
         return persistedProperties;
@@ -479,13 +474,8 @@
         {
             nonPersistedProperties = new HashMap<>();
 
-            for ( Map.Entry<String, Property> entry : getPropertyMap().entrySet() )
-            {
-                if ( !entry.getValue().isPersisted() )
-                {
-                    nonPersistedProperties.put( entry.getKey(), entry.getValue() );
-                }
-            }
+            getPropertyMap().entrySet().stream().filter( entry -> !entry.getValue().isPersisted() )
+                .forEach( entry -> nonPersistedProperties.put( entry.getKey(), entry.getValue() ) );
         }
 
         return nonPersistedProperties;
@@ -533,13 +523,8 @@
         {
             List<String> authorityList = Lists.newArrayList();
 
-            for ( Authority authority : authorities )
-            {
-                if ( type.equals( authority.getType() ) )
-                {
-                    authorityList.addAll( authority.getAuthorities() );
-                }
-            }
+            authorities.stream().filter( authority -> type.equals( authority.getType() ) )
+                .forEach( authority -> authorityList.addAll( authority.getAuthorities() ) );
 
             authorityMap.put( type, authorityList );
         }