Java examples for java.util:List Compare
get Different Element between two String list
/*/*from www . j av a 2s . co m*/ * @(#)2013-10-12 V1.0 * * Copyright 2013 WELL-SOFT, Inc. All rights reserved. */ //package com.java2s; import java.util.*; public class Main { public static void main(String[] argv) { List minList = java.util.Arrays.asList("asdf", "java2s.com"); List maxList = java.util.Arrays.asList("asdf", "java2s.com"); System.out.println(getDifferentElement(minList, maxList)); } public static List<String> getDifferentElement(List<String> minList, List<String> maxList) { List<String> newList = new ArrayList<String>(); for (String max : maxList) { if (!(minList.contains(max))) { newList.add(max); } } return newList; } }