Create new Linked Hash Map - Java java.util

Java examples for java.util:Collection Creation

Description

Create new Linked Hash Map

Demo Code


//package com.java2s;

import java.util.LinkedHashMap;

import java.util.Map;

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

    public static <K, V> LinkedHashMap<K, V> newLinkedHashMap() {
        return new LinkedHashMap<K, V>();
    }

    public static <K, V> LinkedHashMap<K, V> newLinkedHashMap(
            final int initialCapacity) {
        return new LinkedHashMap<K, V>(initialCapacity);
    }

    public static <K, V> LinkedHashMap<K, V> newLinkedHashMap(
            final int initialCapacity, final float loadFactor) {
        return new LinkedHashMap<K, V>(initialCapacity, loadFactor);
    }

    public static <K, V> LinkedHashMap<K, V> newLinkedHashMap(
            final Map<? extends K, ? extends V> m) {
        return new LinkedHashMap<K, V>(m);
    }
}

Related Tutorials