Class SyncList<Existing,​Master>

  • Type Parameters:
    Existing - The Class Object of the existing items
    Master - The Class Object of the master items

    public class SyncList<Existing,​Master>
    extends java.lang.Object
    This Utility Class provides a way to determine compare a 'master' list of items to an 'existing' list of items. The comparison results in a list master items that need to be added, a list of items that need to be updated, and a list of existing items that need to be removed.

    Example:

    
    
     MatchFunction matchFunction1 = (VirtualImage v, Map m) ->
     {
         return v.id == m.id;
     };
    
     SyncList<VirtualImage,Map> syncList = new SyncList(matchFunction1);
     SyncListResult syncResult = syncList.buildSyncLists(existingItems, masterItems);
     System.out.println("Items to add: " + syncResult.addList.size());
     System.out.println("Items to update: " + syncResult.updateList.size());
     System.out.println("Items to remove: " + syncResult.removeList.size());