Class MapUtil

java.lang.Object
com.itextpdf.commons.utils.MapUtil

public final class MapUtil extends Object
Utility class for work with collections. Not for public use.
  • Method Summary

    Modifier and Type
    Method
    Description
    static V> boolean
    equals(MapV> m1, MapV> m2)
    Checks if two maps are equal: the are of the same types and has equal number of stored entries and both has the same set of keys ans each key is associated with an appropriate value.
    static V> int
    getHashCode(MapV> m1)
    Calculates the hash code of the map.
    static V> void
    merge(MapV> destination, MapV> source, BiFunctionV,V> valuesMerger)
    Merges data from source Map into destination Map using provided function if key exists in both Maps.
    static V> void
    putIfNotNull(MapV> map, K key, V value)
    Puts value to map if the value is not null.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • equals

      public static  V> boolean equals (MapV> m1, MapV> m2)
      Checks if two maps are equal: the are of the same types and has equal number of stored entries and both has the same set of keys ans each key is associated with an appropriate value.
      Type Parameters:
      K - is a type of keys
      V - is a type of values
      Parameters:
      m1 - is the first map
      m2 - is the second map
      Returns:
      true if maps are equal and false otherwise
    • merge

      public static  V> void merge (MapV> destination, MapV> source, BiFunctionV,V> valuesMerger)
      Merges data from source Map into destination Map using provided function if key exists in both Maps. If key doesn't exist in destination Map in will be putted directly.
      Type Parameters:
      K - is a type of keys
      V - is a type of values
      Parameters:
      destination - Map to which data will be merged.
      source - Map from which data will be taken.
      valuesMerger - function which will be used to merge Maps values.
    • getHashCode

      public static  V> int getHashCode (MapV> m1)
      Calculates the hash code of the map.
      Type Parameters:
      K - is a type of keys
      V - is a type of values
      Parameters:
      m1 - is the map
      Returns:
      the hash code of the map.
    • putIfNotNull

      public static  V> void putIfNotNull (MapV> map, K key, V value)
      Puts value to map if the value is not null.
      Type Parameters:
      K - is a type of key
      V - is a type of value
      Parameters:
      map - the map in which value can be pushed
      key - the key
      value - the value