dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #33040
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 16816: Supportive method
------------------------------------------------------------
revno: 16816
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2014-09-25 14:50:57 +0200
message:
Supportive method
modified:
dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ListUtils.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-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ListUtils.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ListUtils.java 2014-08-15 07:40:20 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ListUtils.java 2014-09-25 12:50:57 +0000
@@ -80,6 +80,24 @@
}
/**
+ * Retains only elements in the give list that are part of the given retain
+ * list.
+ *
+ * @param list the target list.
+ * @param retain the elements to retain in the target list.
+ */
+ public static <T> List<T> retainAll( List<T> list, List<T> retain )
+ {
+ if ( list == null || retain == null )
+ {
+ return list;
+ }
+
+ list.retainAll( retain );
+ return list;
+ }
+
+ /**
* Returns a sublist of the given list with the elements at the given indexes.
*
* @param list the list to select from.