Package org.opencms.gwt.client.util
Class CmsClientCollectionUtil
java.lang.Object
org.opencms.gwt.client.util.CmsClientCollectionUtil
A utility class with functions for dealing with maps.
- Since:
- 8.0.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic <A> Set<A>
intersection
(Set<A> first, Set<A> second) Returns the intersection of two sets without modifying the original sets.static boolean
isEmptyOrNull
(Collection<?> collection) Checks whether a collection is empty or null.parseProperties
(String text) Parses properties from a string and returns them in a map.static <A,
B> Map<A, B> removeNullEntries
(Map<A, B> map) Returns a new map with all entries of the input map except those which have a value of null.static <A,
B> void updateMapAndRemoveNulls
(Map<A, B> source, Map<A, B> target) Copies entries from one map to another and deletes those entries in the target map for which the value in the source map is null.
-
Method Details
-
intersection
Returns the intersection of two sets without modifying the original sets.- Type Parameters:
A
- the type of objects contained in the sets- Parameters:
first
- the first setsecond
- the second set- Returns:
- the intersection of both sets
-
isEmptyOrNull
Checks whether a collection is empty or null.- Parameters:
collection
- a collection- Returns:
- true if
collection
isnull
or empty.
-
parseProperties
Parses properties from a string and returns them in a map.- Parameters:
text
- the text containing the properties- Returns:
- the map with the parsed properties
-
removeNullEntries
Returns a new map with all entries of the input map except those which have a value of null.- Type Parameters:
A
- the key type of the mapB
- the value type of the map- Parameters:
map
- the input map- Returns:
- a map with all null entries removed
-
updateMapAndRemoveNulls
Copies entries from one map to another and deletes those entries in the target map for which the value in the source map is null.- Type Parameters:
A
- the key type of the mapB
- the value type of the map- Parameters:
source
- the source maptarget
- the target map
-