Saturday 7 October 2017

CSV Comparision


Here is the explanatory video and following method :




public class compareCSV {

/**
* @param args
* @throws IOException
         * @author : Aman Saraf Jain
*/
public static void main(String[] args) throws IOException {

HashSet<String> f1 = new HashSet<String>(FileUtils.readLines(new File("C:\\Users\\Aman\\Desktop\\demo\\1.csv")));
HashSet<String> f2 = new HashSet<String>(FileUtils.readLines(new File("C:\\Users\\Aman\\Desktop\\demo\\2.csv")));
f1.removeAll(f2); // f1 now contains only the lines which are not in f2

System.out.println(f1.toString());

}

}