Here you can find the source of addDistinctList(List
public static <V> int addDistinctList(List<V> sourceList, List<V> entryList)
//package com.java2s; /**//from ww w.j av a 2s .c o m * Copyright (c) 2014 http://www.lushapp.wang * * Licensed under the Apache License, Version 2.0 (the "License"); */ import java.util.List; public class Main { public static <V> int addDistinctList(List<V> sourceList, List<V> entryList) { if (sourceList == null || isEmpty(entryList)) { return 0; } int sourceCount = sourceList.size(); for (V entry : entryList) if (!sourceList.contains(entry)) { sourceList.add(entry); } return sourceList.size() - sourceCount; } public static boolean isEmpty(List<?> sourceList) { return (sourceList == null || sourceList.size() == 0); } }