Java tutorial
//package com.java2s; import java.util.ArrayList; public class Main { public static int countDiffElmts(ArrayList<String> u, ArrayList<String> v) { ArrayList<String> listOne = new ArrayList<String>(); ArrayList<String> listTwo = new ArrayList<String>(); listOne.addAll(u); listOne.retainAll(v); listTwo.addAll(u); listTwo.addAll(v); listTwo.removeAll(listOne); return listTwo.size(); } }