Wednesday, 17 July 2013

InsertList RemoveList Easy Approach


import java.util.ArrayList;
import java.util.List;

public class ListCompApa {
    public static void main(String[] args) {
       
       
           

         final List<String> gatewaylist = new ArrayList<String>();
   
         gatewaylist.add("namea");
         gatewaylist.add("sam");
         final List<String> dblist = new ArrayList<String>();
         dblist.add("ddd");
         dblist.add("lll");
         dblist.add("namea");
       
         final List<String> insertList = new ArrayList<String>(gatewaylist);
         insertList.removeAll(dblist);
         final List<String> removeList = new ArrayList<String>(dblist);
         removeList.removeAll(gatewaylist);
         System.out.println("gatewaylist ins "+insertList);
         System.out.println("dblist rem "+removeList);
       
    }

}

No comments:

Post a Comment

Pass a HashMap from Angular Client to Spring boot API

This example is for the case where fileData is very huge and in json format   let map = new Map<string, string>()      map.set(this.ge...