← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 20684: minor lambda updates

 

------------------------------------------------------------
revno: 20684
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2015-10-14 13:57:30 +0700
message:
  minor lambda updates
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSet.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/Section.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/dataset/DataSet.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSet.java	2015-10-05 17:45:17 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSet.java	2015-10-14 06:57:30 +0000
@@ -815,32 +815,16 @@
             }
 
             dataElements.clear();
-
-            for ( DataElement dataElement : dataSet.getDataElements() )
-            {
-                addDataElement( dataElement );
-            }
+            dataSet.getDataElements().forEach( this::addDataElement );
 
             indicators.clear();
-
-            for ( Indicator indicator : dataSet.getIndicators() )
-            {
-                addIndicator( indicator );
-            }
+            dataSet.getIndicators().forEach( this::addIndicator );
 
             compulsoryDataElementOperands.clear();
-
-            for ( DataElementOperand dataElementOperand : dataSet.getCompulsoryDataElementOperands() )
-            {
-                addCompulsoryDataElementOperand( dataElementOperand );
-            }
+            dataSet.getCompulsoryDataElementOperands().forEach( this::addCompulsoryDataElementOperand );
 
             removeAllOrganisationUnits();
-
-            for ( OrganisationUnit organisationUnit : dataSet.getSources() )
-            {
-                addOrganisationUnit( organisationUnit );
-            }
+            dataSet.getSources().forEach( this::addOrganisationUnit );
 
             attributeValues.clear();
             attributeValues.addAll( dataSet.getAttributeValues() );

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/Section.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/Section.java	2015-10-05 17:45:17 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/Section.java	2015-10-14 06:57:30 +0000
@@ -170,7 +170,7 @@
     {
         return dataElements != null && !dataElements.isEmpty();
     }
-    
+
     @Override
     public boolean haveUniqueNames()
     {
@@ -286,18 +286,10 @@
             }
 
             removeAllDataElements();
-
-            for ( DataElement dataElement : section.getDataElements() )
-            {
-                addDataElement( dataElement );
-            }
+            section.getDataElements().forEach( this::addDataElement );
 
             removeAllGreyedFields();
-
-            for ( DataElementOperand dataElementOperand : section.getGreyedFields() )
-            {
-                addGreyedField( dataElementOperand );
-            }
+            section.getGreyedFields().forEach( this::addGreyedField );
         }
     }
 }