java - Why after retainAll() the list comes to be null although it should has elements in it? -


now can list a, list b. , want new list a-(intersection of , b). when intersection, [].

        list<map<string,string>> userdevices = clientdeviceservice.getuserdevice(userid);         list<string> selecteddevices = new arraylist<string>(arrays.aslist(devices));//selecteddevices  is------[stress0012,stress0014,]         list<string> originaldevices = new arraylist<string>();         list<string> originaldevicesretain = new arraylist<string>();//copy operating         for(map<string,string> originaldevid : userdevices){             originaldevices.add(originaldevid.get("devid"));         }         originaldevicesretain.addall(originaldevices);         originaldevicesretain.retainall(selecteddevices);         //originaldevicesretain [],and return false.         originaldevices.removeall(originaldevicesretain);         if(!originaldevices.isempty()){          } 

why originaldevices [] has no elements in it?


Popular posts from this blog

php - How should I create my API for mobile applications (Needs Authentication) -

5 Reasons to Blog Anonymously (and 5 Reasons Not To)

Google AdWords and AdSense - A Dynamic Small Business Marketing Duo