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;

public class Main {

    public static Object[] removeDuplicate(Object[] objs) {

        ArrayList<Object> objectArrayList = new ArrayList<Object>();
        if (objs == null || objs.length < 1) {
            return null;
        } else {
            for (int i = 0; i < objs.length; i++) {
                for (int j = objs.length; j > i; j--) {
                    if (!objs[j].equals(objs[i])) {
                        objectArrayList.add(objs[j]);
                    }
                }
            }

            Object[] objects = new Object[objectArrayList.size()];
            objects = objectArrayList.toArray(objects);
            return objects;
        }

    }
}