Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

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

public class Main {
    static public <T> void unique(List<T> list) {
        HashSet<T> h = new HashSet<T>();
        for (T i : list) {
            h.add(i);
        }
        list.clear();
        for (T i : h) {
            list.add(i);
        }
    }
}