Package com.morpheusdata.core.util
Class SyncList<Existing,Master>
java.lang.Object
com.morpheusdata.core.util.SyncList<Existing,Master>
- Type Parameters:
Existing
- The Class Object of the existing itemsMaster
- The Class Object of the master items
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);
SyncResult 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());
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
static class
static class
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuildSyncLists
(Collection<Existing> existingItems, Collection<Master> masterItems)
-
Constructor Details
-
SyncList
-
-
Method Details
-
buildSyncLists
public SyncList.SyncResult buildSyncLists(Collection<Existing> existingItems, Collection<Master> masterItems)
-