java - The algorithm compares two lists, synchronization tables -
the algorithm compares 2 lists list, synchronization tables i need synchronize local table table loaded server. decided compare 2 stages list (local list , server). initially, list sorted. remains landmark in comparing of id. if id on local list is, , server not present, removal of entries local database (delete). if id equal local server , update (update). if id server there, , there no local, add (select). problem have in phase comparison, somewhere wrong, not foreseen. i throw off comparison algorithm, began write, not finish image , example. please modify it. image example: http://c2n.me/3mmgizg list<integer> server = new arraylist<>(); list<integer> local = new arraylist<>(); databasehandler db = new databasehandler(context); iterator<integer> seriter = server.iterator(); iterator<integer> lociter = local.iterator(); int item1 = seriter.next(); int item2 = lociter.next(); while(seriter.hasnext()) { if (item1 <item2) { ...