package org.bdgp.MMSlide;

import java.util.Arrays;
import java.util.List;

public class Util {
    /**
     * Custom HashMap with support for pseudo-map literals.
     * @param <K> The key type
     * @param <V>
     */
    @SuppressWarnings("serial")
    public static class HashMap<K,V> extends java.util.HashMap<K,V> {
        public HashMap() {
            super();
        }
        // Various chained putters
        public HashMap<K,V> with(K k, V v) { this.put(k, v); return this; }
        public HashMap<K,V> and(K k, V v) { this.put(k, v); return this; }
        public HashMap<K,V> o(K k, V v) { this.put(k, v); return this; }
        public HashMap<K,V> _(K k, V v) { this.put(k, v); return this; }
    }
    // static methods for creating various HashMaps
    public static <K,V> HashMap<K,V> map(K k, V v) {
        return new HashMap<K,V>().with(k, v);
    }
    public static HashMap<String,Object> set(String k, Object v) {
        return new HashMap<String,Object>().with(k, v);
    }
    public static HashMap<String,Object> where(String k, Object v) {
        return new HashMap<String,Object>().with(k, v);
    }
    public static HashMap<String,String> attr(String k, String v) {
        return new HashMap<String,String>().with(k, v);
    }
        
    /**
     * Simple static function for list literals.
     * @param values The list of things to turn into a list literal.
     * @return
     */
    public static <V> List<V> list(V ... values) {
        return Arrays.asList(values);
    }
    
}

@@ -67,16 +67,38 @@
 il.List;
+%0Aimport java.util.Map;
 %0A%0Apublic
@@ -724,24 +724,161 @@
 urn this; %7D%0A
+        // in-place merge%0A        public Map%3CK,V%3E merge(Map%3CK,V%3E map) %7B%0A            this.putAll(map);%0A            return this;%0A        %7D%0A
     %7D%0A    //
@@ -1020,32 +1020,183 @@
 th(k, v);%0A    %7D%0A
+    public static %3CK,V%3E HashMap%3CK,V%3E map(Map%3CK,V%3E m) %7B%0A        HashMap%3CK,V%3E map = new HashMap%3CK,V%3E();%0A        map.putAll(m);%0A        return map;%0A    %7D%0A
     public stati
@@ -1565,24 +1565,440 @@
 , v);%0A    %7D%0A
+    %0A    @SuppressWarnings(%22serial%22)%0A    public static class ArrayList%3CV%3E extends java.util.ArrayList%3CV%3E %7B%0A        public ArrayList() %7B%0A            super();%0A        %7D%0A        public ArrayList%3CV%3E concat(List%3CV%3E l) %7B%0A            this.addAll(l);%0A            return this;%0A        %7D%0A        public ArrayList%3CV%3E push(V ... values) %7B%0A            this.addAll(Arrays.asList(values));%0A            return this;%0A        %7D%0A    %7D%0A
         %0A   
@@ -2238,15 +2238,152 @@
 ;%0A    %7D%0A
-
     
+public static %3CV%3E List%3CV%3E list(List%3CV%3E l) %7B%0A        List%3CV%3E list = new ArrayList%3CV%3E();%0A        list.addAll(l);%0A        return list;%0A    %7D
 %0A%7D%0A

add more utility routines