Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.util.*;

public class Main {
    public static <T> LinkedHashSet<T> asLinkedHashSetRemoveNulls(T[] elements) {
        LinkedHashSet<T> result = new LinkedHashSet<>(elements.length);
        for (T element : elements) {
            if (element != null) {
                result.add(element);
            }
        }

        return result;
    }
}