Here you can find the source of getSymmetricDifference(final Set
Parameter | Description |
---|---|
firstCollection | - Set of property names |
secondCollection | - Set of property names |
public static List<String> getSymmetricDifference(final Set<String> firstCollection, final Set<String> secondCollection)
//package com.java2s; /*//from w w w .ja v a 2s . co m * Inspired by the Commons Collections package created by Apache * http://commons.apache.org/collections/ * http://www.apache.org/licenses/LICENSE-2.0 */ import java.util.*; public class Main { /** * Finds all unique property names that are in the first set, but not in the second * @param firstCollection - Set of property names * @param secondCollection - Set of property names * @return - unique property names that are present in the first set but not in the second */ public static List<String> getSymmetricDifference(final Set<String> firstCollection, final Set<String> secondCollection) { List<String> difference = new ArrayList<String>(firstCollection); for (String value : secondCollection) { difference.remove(value); } return difference; } }