Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.ArrayList;
import java.util.Collection;

import java.util.HashSet;
import java.util.List;

import java.util.Set;

public class Main {

    public static <T> List<T> distinct(List<T> list) {
        Set<T> set = getSet(list);
        return getList(set);
    }

    public static <T> Set<T> getSet() {
        return new HashSet<T>();
    }

    public static <T> Set<T> getSet(Collection<T> collection) {
        return new HashSet<T>(collection);
    }

    public static <T> List<T> getList() {
        return new ArrayList<T>();
    }

    public static <T> List<T> getList(Collection<T> source) {
        return new ArrayList<T>(source);
    }
}