Java tutorial
//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; } }