// understandingcollections/FillMapTest.java // (c)2016 MindView LLC: see Copyright.txt // We make no guarantees that this code is fit for any purpose. // Visit http://mindviewinc.com/Books/OnJava/ for more book information. import java.util.*; import java.util.function.*; import java.util.stream.*; import onjava.*; public class FillMapTest { public static void main(String[] args) { Map mcs = FillMap.basic( new Rand.String(4), new Count.Integer(), 7); System.out.println(mcs); HashMap hashm = FillMap.create( new Rand.String(4), new Count.Integer(), HashMap::new, 7); System.out.println(hashm); LinkedHashMap linkm = FillMap.create( new Rand.String(4), new Count.Integer(), LinkedHashMap::new, 7); System.out.println(linkm); } } /* Output: {npcc=1, ztdv=6, gvgm=3, btpe=0, einn=4, eelo=5, uxsz=2} {npcc=1, ztdv=6, gvgm=3, btpe=0, einn=4, eelo=5, uxsz=2} {btpe=0, npcc=1, uxsz=2, gvgm=3, einn=4, eelo=5, ztdv=6} */