Create new Hashtable - Java java.util

Java examples for java.util:Collection Creation

Description

Create new Hashtable

Demo Code


//package com.java2s;

import java.util.Hashtable;

import java.util.Map;

public class Main {
    public static void main(String[] argv) {
        System.out.println(newHashtable());
    }//ww w .  ja v a  2s .c  o  m

    public static <K, V> Hashtable<K, V> newHashtable() {
        return new Hashtable<K, V>();
    }

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

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

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

Related Tutorials