Class 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>
      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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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 set
        second - 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 is null 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 map
        B - 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 map
        B - the value type of the map
        Parameters:
        source - the source map
        target - the target map