Java HashMap Create newHashMap()

Here you can find the source of newHashMap()

Description

Constructs an empty HashMap.

License

Apache License

Declaration

public static final <k, v> HashMap<k, v> newHashMap() 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.HashMap;

import java.util.Map;

public class Main {
    /**/*from www.j a  v  a  2  s  .c  o m*/
     * Constructs an empty HashMap.
     */
    public static final <k, v> HashMap<k, v> newHashMap() {
        return new HashMap<k, v>();
    }

    /**
     * Constructs an empty HashMap.
     */
    public static final <k, v> Map<k, v> newHashMap(k key, v value) {
        Map<k, v> map = newHashMap();
        map.put(key, value);
        return map;
    }
}

Related

  1. newHashMap( Map map)
  2. newHashMap()
  3. newHashMap()
  4. newHashMap()
  5. newHashMap()
  6. newHashMap()
  7. newHashMap()
  8. newHashMap()
  9. newHashMap(final int initCapacity)