Class MapBuilder<K,​V>

  • Type Parameters:
    K - Key type
    V - Value type

    public class MapBuilder<K,​V>
    extends java.lang.Object
    Helper class to build HashMaps in a builder pattern style.
    • Constructor Summary

      Constructors 
      Constructor Description
      MapBuilder()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.HashMap<K,​V> build()
      Builds the map.
      MapBuilder<K,​V> put​(K key, V value)
      Puts a key-value pair into the map.
      • Methods inherited from class java.lang.Object

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

      • MapBuilder

        public MapBuilder()
    • Method Detail

      • put

        public MapBuilder<K,​V> put​(K key,
                                         V value)
        Puts a key-value pair into the map.
        Parameters:
        key - key
        value - value
        Returns:
        The builder instance
      • build

        public java.util.HashMap<K,​V> build()
        Builds the map.
        Returns:
        The built map