0

I have a list of JSON Objects as: [{"name":"abc","id":"123"},{"name":"xyz","id":"345"}..] and a set of parameters like {"abc","def","xyz"}. I want to check whether the second set of parameters contains value that are not in name field of JSON Object in first array.

The algorithm I followed is:

Boolean flag = false;
   for{name : nameSet} {
     if(jsonObject.get("name")!=name{
       flag = true;
     }
   }

   if(flag){
     System.out.print("not matched");
   }

Are there any efficient way of doing it? Please suggest?

4

1 に答える 1