Here you can find the source of distinct(List
public static <T> List<T> distinct(List<T> vector)
//package com.java2s; //License from project: Apache License import java.util.ArrayList; import java.util.List; public class Main { public static <T> List<T> distinct(List<T> vector) { List<T> distinctVector = new ArrayList<T>(); vector.stream().distinct().forEach(s -> distinctVector.add(s)); return distinctVector; }//from ww w. j av a2s . co m }