differences between two arrays [duplicate]

Convert array to Set<String>

new HashSet<String>(Arrays.asList(array));

and do

Set<String> commonOnes = biggerSet.retainAll(smallerSet);
biggerSet.removeAll(commonOnes).add(smallerSet.removeAll(commonOnes))

or use guava difference()

Leave a Comment