@@ -0,0 +1,685 @@
+package autovivification;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.HashMap;%0Aimport java.util.List;%0Aimport java.util.Map;%0Aimport java.util.function.Supplier;%0A%0Apublic interface autovivification1 %7B%0A  interface Dict%3CK,V%3E %7B%0A    V get(K key);%0A    %0A    public static %3CK,V%3E Dict%3CK, V%3E asDict(Map%3CK, V%3E map, Supplier%3C? extends V%3E factory) %7B%0A      return key -%3E map.computeIfAbsent(key, k -%3E factory.get());%0A    %7D%0A  %7D%0A%0A  public static void main(String%5B%5D args) %7B%0A    HashMap%3CString, List%3CString%3E%3E map = new HashMap%3C%3E();%0A    Dict%3CString, List%3CString%3E%3E dict = Dict.asDict(map, ArrayList::new);%0A    dict.get(%22foo%22).add(%22bar%22);%0A    dict.get(%22foo%22).add(%22baz%22);%0A    System.out.println(map);%0A  %7D%0A%7D%0A

Add auto-vivification