Creates a new empty HashMap with the inferred type. - Java java.util

Java examples for java.util:HashMap

Description

Creates a new empty HashMap with the inferred type.

Demo Code


//package com.book2s;

import java.util.HashMap;

public class Main {
    public static void main(String[] argv) {
        System.out.println(map());
    }//from   w ww . j a va 2  s .c om

    /**
     * Creates a new empty {@link HashMap} with the inferred type.
     */
    public static <T1, T2> HashMap<T1, T2> map() {
        return new HashMap<T1, T2>();
    }
}

Related Tutorials