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.HashSet;

public class Main {

    @SuppressWarnings({ "unchecked", "rawtypes" })
    public static void removeDuplicate(ArrayList arlList) {
        HashSet h = new HashSet(arlList);
        arlList.clear();
        arlList.addAll(h);
    }

    @SuppressWarnings({ "unchecked", "rawtypes" })
    public static ArrayList removeDuplicate(ArrayList arlList, ArrayList list) {
        for (Object object : list) {
            if (!arlList.contains(object)) {
                arlList.add(object);
            }
        }
        return arlList;
    }
}