I'm trying to compare the ArrayList values between the server ArrayList and local DB ArrayList. Where I compare the ID of each ArrayList object from Server and local DB ArrayList and store if its new data to the DB ArrayList. 

Below is my Code.

```
if(!listServer.isEmpty()){
    for(Model server:listServer){
         for(Model Db:listDb){
             while(!listServer.get( i ).getid().equals(listDb.get(i).getid() )){
                  storeIntoDb.add( listServer.get( i ) );
             }
         }
    }
}

```

I get an infinite loop in the new list which needed to store into local DB. Actually what I want is to compare if I have a new data in the server then store it into local DB.