Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.util.*;

public class Main {
    public static <E> List<E> distinct(List<E> elements) {
        List<E> result = new ArrayList<>();
        for (E element : elements) {
            if (!result.contains(element)) {
                result.add(element);
            }
        }
        return result;
    }
}