Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

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

import java.util.ArrayList;

import java.util.LinkedHashSet;
import java.util.List;

import java.util.Set;

public class Main {
    /**
     * Removes the duplicates.
     * 
     * @param <T>
     *            the generic type
     * @param items
     *            the items
     * @return the list
     */
    public static <T> List<T> removeDuplicates(List<T> items) {
        Set<T> set = new LinkedHashSet<T>();
        set.addAll(items);
        return new ArrayList<T>(set);
    }
}