Class Map.Builder<K,V>

java.lang.Object
me.sbasalaev.collection.Map.Builder<K,V>
Enclosing class:
Map<K,V>

public static final class Map.Builder<K,V> extends Object
Builder of immutable maps.
  • Method Details

    • add

      public Map.Builder<K,V> add(K key, V value)
      Adds entry to the map being built.
      Returns:
      this builder.
    • add

      public Map.Builder<K,V> add(Entry<K,V> entry)
      Adds entry to the map being built.
      Returns:
      this builder.
    • toMap

      public Map<K,V> toMap()
      Creates new immutable map with entries added to this builder. Can be used multiple times.