30 lines
1001 B
Java
30 lines
1001 B
Java
// collectiontopics/FillMapTest.java
|
|
// (c)2017 MindView LLC: see Copyright.txt
|
|
// We make no guarantees that this code is fit for any purpose.
|
|
// Visit http://OnJava8.com 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<String,Integer> mcs = FillMap.basic(
|
|
new Rand.String(4), new Count.Integer(), 7);
|
|
System.out.println(mcs);
|
|
HashMap<String,Integer> hashm =
|
|
FillMap.create(new Rand.String(4),
|
|
new Count.Integer(), HashMap::new, 7);
|
|
System.out.println(hashm);
|
|
LinkedHashMap<String,Integer> 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}
|
|
*/
|