Package org.opencms.gwt.client.util
Class CmsClientCollectionUtil
- java.lang.Object
-
- org.opencms.gwt.client.util.CmsClientCollectionUtil
-
public final class CmsClientCollectionUtil extends java.lang.Object
A utility class with functions for dealing with maps.- Since:
- 8.0.0
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <A> java.util.Set<A>
intersection(java.util.Set<A> first, java.util.Set<A> second)
Returns the intersection of two sets without modifying the original sets.static boolean
isEmptyOrNull(java.util.Collection<?> collection)
Checks whether a collection is empty or null.static java.util.Map<java.lang.String,java.lang.String>
parseProperties(java.lang.String text)
Parses properties from a string and returns them in a map.static <A,B>
java.util.Map<A,B>removeNullEntries(java.util.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>
voidupdateMapAndRemoveNulls(java.util.Map<A,B> source, java.util.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 Detail
-
intersection
public static <A> java.util.Set<A> intersection(java.util.Set<A> first, java.util.Set<A> second)
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
public static boolean isEmptyOrNull(java.util.Collection<?> collection)
Checks whether a collection is empty or null.- Parameters:
collection
- a collection- Returns:
- true if
collection
isnull
or empty.
-
parseProperties
public static java.util.Map<java.lang.String,java.lang.String> parseProperties(java.lang.String text)
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
public static <A,B> java.util.Map<A,B> removeNullEntries(java.util.Map<A,B> map)
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
public static <A,B> void updateMapAndRemoveNulls(java.util.Map<A,B> source, java.util.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.- Type Parameters:
A
- the key type of the mapB
- the value type of the map- Parameters:
source
- the source maptarget
- the target map
-
-