+
+ private void remove(final M implementation, final Set<I> oprsToRemove,
+ final Builder<K, E> tableInputBuilder) {
+ final ListMultimap<K, D> toRemove = decomposeIdentifiers(oprsToRemove);
+
+ for (Entry<K, E> e : this.operations.entrySet()) {
+ final List<D> removed = new ArrayList<>(toRemove.removeAll(e.getKey()));
+ if (!removed.isEmpty()) {
+ final E ne = (E) e.getValue().remove(implementation, removed);
+ if (ne != null) {
+ tableInputBuilder.put(e.getKey(), ne);
+ }
+ } else {
+ tableInputBuilder.put(e);
+ }
+ }
+ }
+
+ AbstractDOMRoutingTable<I, D, M, L, K, E> removeAll(final Map<I, M> map) {
+ if (map.isEmpty()) {
+ return this;
+ }
+ HashMultimap<M, I> inverted = invertImplementationsMap(map);
+
+ final Builder<K, E> tableInputBuilder = ImmutableMap.builder();
+ for (M impl : inverted.keySet()) {
+ remove(impl, inverted.get(impl), tableInputBuilder);
+ }
+
+ return newInstance(tableInputBuilder.build(), schemaContext);
+ }
+
+ HashMultimap<M, I> invertImplementationsMap(final Map<I, M> map) {
+ return Multimaps.invertFrom(Multimaps.forMap(map), HashMultimap.create());
+ }
+