Create new Linked Hash Set - Java java.util

Java examples for java.util:Set Creation

Description

Create new Linked Hash Set

Demo Code


//package com.java2s;

import java.util.Collection;

import java.util.LinkedHashSet;

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

    public static <E> LinkedHashSet<E> newLinkedHashSet() {
        return new LinkedHashSet<E>();
    }

    public static <E> LinkedHashSet<E> newLinkedHashSet(
            final Collection<? extends E> c) {
        return new LinkedHashSet<E>(c);
    }

    public static <E> LinkedHashSet<E> newLinkedHashSet(
            final int initialCapacity) {
        return new LinkedHashSet<E>(initialCapacity);
    }

    public static <E> LinkedHashSet<E> newLinkedHashSet(
            final int initialCapacity, final float loadFactor) {
        return new LinkedHashSet<E>(initialCapacity, loadFactor);
    }
}

Related Tutorials