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
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());
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
SyncList.MatchFunction<Existing,Master>
static class
SyncList.SyncResult<Master,Existing>
static class
SyncList.UpdateItem<Existing,Master>
-
Constructor Summary
Constructors Constructor Description SyncList(SyncList.MatchFunction... matchFunctions)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SyncList.SyncResult
buildSyncLists(java.util.Collection<Existing> existingItems, java.util.Collection<Master> masterItems)
-
-
-
Constructor Detail
-
SyncList
public SyncList(SyncList.MatchFunction... matchFunctions)
-
-
Method Detail
-
buildSyncLists
public SyncList.SyncResult buildSyncLists(java.util.Collection<Existing> existingItems, java.util.Collection<Master> masterItems)
-
-