dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #40566
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 20591: Lambda
------------------------------------------------------------
revno: 20591
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2015-10-08 17:04:40 +0200
message:
Lambda
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/IdentifiableObjectUtils.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/common/IdentifiableObjectUtils.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/IdentifiableObjectUtils.java 2015-10-08 14:59:36 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/IdentifiableObjectUtils.java 2015-10-08 15:04:40 +0000
@@ -313,25 +313,15 @@
}
/**
- * Returns a mapping between the uid and the name of the given identifiable
- * objects.
+ * Returns a mapping between the uid and the display name of the given
+ * identifiable objects.
*
* @param objects the identifiable objects.
- * @return mapping between the uid and the name of the given objects.
+ * @return mapping between the uid and the display name of the given objects.
*/
public static Map<String, String> getUidNameMap( Collection<? extends IdentifiableObject> objects )
- {
- Map<String, String> map = new HashMap<>();
-
- if ( objects != null )
- {
- for ( IdentifiableObject object : objects )
- {
- map.put( object.getUid(), object.getDisplayName() );
- }
- }
-
- return map;
+ {
+ return objects.stream().collect( Collectors.toMap( IdentifiableObject::getUid, IdentifiableObject::getDisplayName ) );
}
/**