@Test public void reAdd() throws Exception { final ArrayList<Item> updates = new ArrayList<>(); updates.add(new Item()); list.update(updates); assertEquals(1, list.size()); list.update(updates); assertEquals(1, list.size()); }
public void update(final Collection<InspectedType> updates) { final ArrayList<UUIDKey> originalItems = new ArrayList<>(map.keySet()); for (final InspectedType updatable : updates) { final InspectorType inspector = map.get(updatable.getUuidKey()); if (inspector != null) { originalItems.remove(updatable.getUuidKey()); continue; } else { final InspectorType newInspector = inspectorFactory.make(updatable); add(newInspector); map.put(updatable.getUuidKey(), newInspector); } } for (final UUIDKey originalItem : originalItems) { remove(map.remove(originalItem)); } }
UpdatableInspectorList extends InspectorList<InspectorType> { public void update(final Collection<InspectedType> updates) { final ArrayList<UUIDKey> originalItems = new ArrayList<>(map.keySet()); for (final InspectedType updatable : updates) { final InspectorType inspector = map.get(updatable.getUuidKey()); if (inspector != null) { originalItems.remove(updatable.getUuidKey()); continue; } else { final InspectorType newInspector = inspectorFactory.make(updatable); add(newInspector); map.put(updatable.getUuidKey(), newInspector); } } for (final UUIDKey originalItem : originalItems) { remove(map.remove(originalItem)); } } }
UpdatableInspectorList extends InspectorList<InspectorType> { public void update(final Collection<InspectedType> updates) { final ArrayList<UUIDKey> originalItems = new ArrayList<>(map.keySet()); for (final InspectedType updatable : updates) { final InspectorType inspector = map.get(updatable.getUuidKey()); if (inspector != null) { originalItems.remove(updatable.getUuidKey()); continue; } else { final InspectorType newInspector = inspectorFactory.make(updatable); add(newInspector); map.put(updatable.getUuidKey(), newInspector); } } for (final UUIDKey originalItem : originalItems) { remove(map.remove(originalItem)); } } UpdatableInspectorList(final InspectorFactory<InspectorType, InspectedType> inspectorFactory,
                                  final AnalyzerConfiguration configuration); }
UpdatableInspectorList extends InspectorList<InspectorType> { public void update(final Collection<InspectedType> updates) { final ArrayList<UUIDKey> originalItems = new ArrayList<>(map.keySet()); for (final InspectedType updatable : updates) { final InspectorType inspector = map.get(updatable.getUuidKey()); if (inspector != null) { originalItems.remove(updatable.getUuidKey()); continue; } else { final InspectorType newInspector = inspectorFactory.make(updatable); add(newInspector); map.put(updatable.getUuidKey(), newInspector); } } for (final UUIDKey originalItem : originalItems) { remove(map.remove(originalItem)); } } UpdatableInspectorList(final InspectorFactory<InspectorType, InspectedType> inspectorFactory,
                                  final AnalyzerConfiguration configuration); void update(final Collection<InspectedType> updates); }
UpdatableInspectorList extends InspectorList<InspectorType> { public void update(final Collection<InspectedType> updates) { final ArrayList<UUIDKey> originalItems = new ArrayList<>(map.keySet()); for (final InspectedType updatable : updates) { final InspectorType inspector = map.get(updatable.getUuidKey()); if (inspector != null) { originalItems.remove(updatable.getUuidKey()); continue; } else { final InspectorType newInspector = inspectorFactory.make(updatable); add(newInspector); map.put(updatable.getUuidKey(), newInspector); } } for (final UUIDKey originalItem : originalItems) { remove(map.remove(originalItem)); } } UpdatableInspectorList(final InspectorFactory<InspectorType, InspectedType> inspectorFactory,
                                  final AnalyzerConfiguration configuration); void update(final Collection<InspectedType> updates);  }