Class MapUtils


  • public class MapUtils
    extends java.lang.Object
    Helper classes to manipulate maps to pass substitution map to the CommandLine. This class is not part of the public API and could change without warning.
    • Constructor Summary

      Constructors 
      Constructor Description
      MapUtils()
      Deprecated.
      Will be private in the next major version.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <K,​V>
      java.util.Map<K,​V>
      copy​(java.util.Map<K,​V> source)
      Clones a map.
      static <K,​V>
      java.util.Map<K,​V>
      merge​(java.util.Map<K,​V> lhs, java.util.Map<K,​V> rhs)
      Clones the lhs map and add all things from the rhs map.
      static <K,​V>
      java.util.Map<java.lang.String,​V>
      prefix​(java.util.Map<K,​V> source, java.lang.String prefix)
      Clones a map and prefixes the keys in the clone, e.g.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • MapUtils

        @Deprecated
        public MapUtils()
        Deprecated.
        Will be private in the next major version.
        Constructs a new instance.
    • Method Detail

      • copy

        public static <K,​V> java.util.Map<K,​V> copy​(java.util.Map<K,​V> source)
        Clones a map.
        Type Parameters:
        K - the map key type.
        V - the map value type.
        Parameters:
        source - the Map to clone.
        Returns:
        the cloned map.
      • merge

        public static <K,​V> java.util.Map<K,​V> merge​(java.util.Map<K,​V> lhs,
                                                                 java.util.Map<K,​V> rhs)
        Clones the lhs map and add all things from the rhs map.
        Type Parameters:
        K - the map key type.
        V - the map value type.
        Parameters:
        lhs - the first map.
        rhs - the second map.
        Returns:
        the merged map.
      • prefix

        public static <K,​V> java.util.Map<java.lang.String,​V> prefix​(java.util.Map<K,​V> source,
                                                                                 java.lang.String prefix)
        Clones a map and prefixes the keys in the clone, e.g. for mapping "JAVA_HOME" to "env.JAVA_HOME" to simulate the behavior of Ant.
        Type Parameters:
        K - the map key type.
        V - the map value type.
        Parameters:
        source - the source map.
        prefix - the prefix used for all names.
        Returns:
        the clone of the source map.