java code to compare csv file against a table

Solutions on MaxInterview for java code to compare csv file against a table by the best coders in the world

showing results for - "java code to compare csv file against a table"
Len
06 Jan 2020
1HashMap<String, String> f1 = new HashMap<String, String>();
2HashMap<String, String> f2 = new HashMap<String, String>();
3// read f1, f2; use PK field as the key
4List<String> deleted = new ArrayList<String>();
5List<String> updated = new ArrayList<String>();
6for(Map.Entry<String, String> entry : f1.keySet()) {
7    if(!f2.containsKey(entry.getKey()) {
8        deleted.add(entry.getValue());
9    } else {
10        if(!f2.get(entry.getKey().equals(f1.getValue())) {
11            updated.add(f1.getValue());
12        }
13    }
14}
15for(String key : f1.keySet()) {
16    f2.remove(key);
17}
18// f2 now contains only "new" rows