package brooklyn.util;

import java.util.LinkedHashMap;
import java.util.Map;

public class MutableMap {

    public static <K,V> Map<K,V> of(K k1, V v1) {
        Map<K,V> result = new LinkedHashMap<K,V>();
        result.put(k1, v1);
        return result;
    }
    
    public static <K,V> Map<K,V> of(K k1, V v1, K k2, V v2) {
        Map<K,V> result = new LinkedHashMap<K,V>();
        result.put(k1, v1);
        result.put(k2, v2);
        return result;
    }
    
    public static <K,V> Map<K,V> of(K k1, V v1, K k2, V v2, K k3, V v3) {
        Map<K,V> result = new LinkedHashMap<K,V>();
        result.put(k1, v1);
        result.put(k2, v2);
        result.put(k3, v3);
        return result;
    }
}

@@ -76,33 +76,328 @@
 p;%0A%0A
-public class MutableMap %7B
+import com.google.common.collect.ImmutableMap;%0A%0A/** Map impl, exposing simple builder operations (add) in a fluent-style API,%0A * where the final map is mutable.  You can also toImmutable. */%0Apublic class MutableMap%3CK,V%3E extends LinkedHashMap%3CK,V%3E %7B%0A    private static final long serialVersionUID = -2463168443382874384L;
 %0A%0A  
@@ -410,32 +410,39 @@
 ic static %3CK,V%3E 
+Mutable
 Map%3CK,V%3E of(K k1
@@ -451,32 +451,39 @@
 V v1) %7B%0A        
+Mutable
 Map%3CK,V%3E result 
@@ -484,34 +484,31 @@
 esult = new 
-LinkedHash
+Mutable
 Map%3CK,V%3E();%0A
@@ -585,32 +585,39 @@
 ic static %3CK,V%3E 
+Mutable
 Map%3CK,V%3E of(K k1
@@ -638,32 +638,39 @@
 V v2) %7B%0A        
+Mutable
 Map%3CK,V%3E result 
@@ -671,34 +671,31 @@
 esult = new 
-LinkedHash
+Mutable
 Map%3CK,V%3E();%0A
@@ -808,16 +808,23 @@
 c %3CK,V%3E 
+Mutable
 Map%3CK,V%3E
@@ -873,16 +873,23 @@
         
+Mutable
 Map%3CK,V%3E
@@ -902,26 +902,23 @@
 t = new 
-LinkedHash
+Mutable
 Map%3CK,V%3E
@@ -1034,10 +1034,330 @@
 ;%0A    %7D%0A
+    %0A    public MutableMap%3CK,V%3E add(K key, V value) %7B%0A        put(key, value);%0A        return this;%0A    %7D%0A%0A    public MutableMap%3CK,V%3E add(Map%3CK,V%3E m) %7B%0A        putAll(m);%0A        return this;%0A    %7D%0A%0A    public ImmutableMap%3CK,V%3E toImmutable() %7B%0A        return ImmutableMap.%3CK,V%3Ebuilder().putAll(this).build();%0A    %7D%0A    %0A
 %7D%0A

add more conveniences to MutableMap (and make it be a map, which is more intuitive)