### Question:
MapPM extends AbstractPM implements IMapPM<K, V> { public Collection<V> removeAllIndices(int[] indices) { Interval[] aintv = Interval.createIntervals(indices); LinkedList<V> result = new LinkedList<V>(); for (int iv = aintv.length - 1; iv >= 0; --iv) { Interval intv = aintv[iv]; selection.removeInterval(intv.startIndex, intv.endIndex); LinkedList<V> removed = new LinkedList<V>(); for (int i = intv.endIndex; i >= intv.startIndex; --i) { V element = entries.remove(i); onRemove(element); removed.add(element); } support.fireElementsRemoved(intv.startIndex, intv.endIndex - intv.startIndex + 1, (Collection<PresentationModel>)removed); result.addAll(removed); } return result; } MapPM(); Sorter getSorter(); void setSorter(Sorter sorter); boolean isRevalidateElementsOnChangeEnabled(); void setRevalidateElementsOnChangeEnabled(boolean enabled); void revalidateElements(); boolean isEmpty(); void clear(); V put(K key, V newElement); V put(K key, V newElement, int toIndex); void swap(int indexA, int indexB); void swap(V elemA, V elemB); void reverse(); void sortBy(boolean ascending, Path... paths); void sortBy(Collection<SortKey> newSortKeys); void sortBy(SortKey... newSortKeys); Collection<SortKey> getSortKeys(); int size(); Collection<V> getAll(int startIndex, int endIndex); Collection<V> getAll(int[] indices); V getAt(int index); V get(K key); V removeAt(int index); V removeKey(K key); boolean remove(V elem); boolean removeAll(Collection<? extends V> col); Collection<V> toCollection(); Map<K, V> toMap(); Object[] toArray(); Set<K> keySet(); boolean containsKey(K key); boolean contains(V element); int indexOfKey(K key); int indexOf(V element); int[] indicesOfKeys(Collection<K> keys); int[] indicesOf(Collection elements); K getKey(V element); K getKey(int index); List<K> getKeys(int beginIndex, int endIndex); Set<K> getKeys(int[] indices); Set<K> getKeys(Collection<?> col); SelectedKeys<K> getSelectedKeys(); Selection<V> getSelection(); void addListListener(ListListener l); void removeListListener(ListListener l); Iterator<V> iterator(); ListIterator<V> listIterator(final int index); Iterator<K> keyiterator(); Collection<V> removeAllKeys(Set<K> keySet); Collection<V> retainAllKeys(Set<K> keySet); Collection<V> removeAllIndices(int[] indices); void putAll(Map<K, V> aMap); void putAll(Collection<Entry<K, V>> aEntries); void setAll(Map<K, V> newMap);  }### Answer:
@Test public void removeAllIndices() { MapPM<Integer, DummyPM> map = new MapPM<Integer, DummyPM>(); final int NUM = 10; populate(map, NUM); int[] indexes = { 2, 3, 4, 7, 8, 9 }; EventCounter counter = new EventCounter(); map.addListListener(counter); map.removeAllIndices(indexes); assertEquals("map.size()", NUM - indexes.length, map.size()); assertEquals("map.getSelection().size()", 0, map.getSelectedKeys().size()); assertEquals("counter.elementsRemoved", 2, counter.elementsRemoved); assertEquals("counter.elementsDeselected", 0, counter.elementsDeselected); assertEquals("map.getSelection().getMaxIndex()", -1, map.getSelection().getMaxIndex()); assertEquals("map.getSelection().getMinIndex()", -1, map.getSelection().getMinIndex()); }