@Test public void indicesOf() { Collection<DummyPM> col = new LinkedList<DummyPM>(); col.add(element); int[] indices = list.indicesOf(col); assertEquals("indices.length", 1, indices.length); assertEquals("indices[0]", elementIndex, indices[0]); }
public int[] indicesOf(Collection<? extends T> col) { if (col == null || col.size() == 0 || isEmpty()) { return new int[0]; } final int len = col.size(); int[] result = new int[len]; int count = 0; for (T elem : col) { int index = indexOf(elem); if (index != -1) { result[count] = index; count++; } } if (count != len) { int[] newResult = new int[count]; System.arraycopy(result, 0, newResult, 0, count); result = newResult; } Arrays.sort(result); return result; }
ListPM extends AbstractPM implements IListPM<T> { public int[] indicesOf(Collection<? extends T> col) { if (col == null || col.size() == 0 || isEmpty()) { return new int[0]; } final int len = col.size(); int[] result = new int[len]; int count = 0; for (T elem : col) { int index = indexOf(elem); if (index != -1) { result[count] = index; count++; } } if (count != len) { int[] newResult = new int[count]; System.arraycopy(result, 0, newResult, 0, count); result = newResult; } Arrays.sort(result); return result; } }
ListPM extends AbstractPM implements IListPM<T> { public int[] indicesOf(Collection<? extends T> col) { if (col == null || col.size() == 0 || isEmpty()) { return new int[0]; } final int len = col.size(); int[] result = new int[len]; int count = 0; for (T elem : col) { int index = indexOf(elem); if (index != -1) { result[count] = index; count++; } } if (count != len) { int[] newResult = new int[count]; System.arraycopy(result, 0, newResult, 0, count); result = newResult; } Arrays.sort(result); return result; } ListPM();  ListPM(int initialCapacity);  ListPM(ArrayList<Entry> list); protected  ListPM(List<Entry> list); }
ListPM extends AbstractPM implements IListPM<T> { public int[] indicesOf(Collection<? extends T> col) { if (col == null || col.size() == 0 || isEmpty()) { return new int[0]; } final int len = col.size(); int[] result = new int[len]; int count = 0; for (T elem : col) { int index = indexOf(elem); if (index != -1) { result[count] = index; count++; } } if (count != len) { int[] newResult = new int[count]; System.arraycopy(result, 0, newResult, 0, count); result = newResult; } Arrays.sort(result); return result; } ListPM();  ListPM(int initialCapacity);  ListPM(ArrayList<Entry> list); protected  ListPM(List<Entry> list); Sorter getSorter(); void setSorter(Sorter sorter); boolean isRevalidateElementsOnChangeEnabled(); void setRevalidateElementsOnChangeEnabled(boolean enabled); void addListListener(ListListener l); void removeListListener(ListListener l); void revalidateElements(); void replace(T oldElement, T newElement); void replace(int index, T newElement); void add(T element); void add(int index, T element); void addAll(Collection<T> col); boolean contains(T element); boolean containsAll(Collection<T> col); void clear(); boolean removeAll(Collection<? extends T> col); boolean remove(T element); T removeAt(int index); void swap(int indexA, int indexB); void swap(T elemA, T elemB); void reverse(); void sortBy(boolean ascending, Path... paths); void sortBy(Collection<SortKey> newSortKeys); void sortBy(SortKey... newSortKeys); Collection<SortKey> getSortKeys(); T getAt(int index); Collection<T> toCollection(); Object[] toArray(); Selection<T> getSelection(); int indexOf(T element); int[] indicesOf(Collection<? extends T> col); int size(); boolean isEmpty(); Iterator<T> iterator(); ListIterator<T> listIterator(final int index); }
ListPM extends AbstractPM implements IListPM<T> { public int[] indicesOf(Collection<? extends T> col) { if (col == null || col.size() == 0 || isEmpty()) { return new int[0]; } final int len = col.size(); int[] result = new int[len]; int count = 0; for (T elem : col) { int index = indexOf(elem); if (index != -1) { result[count] = index; count++; } } if (count != len) { int[] newResult = new int[count]; System.arraycopy(result, 0, newResult, 0, count); result = newResult; } Arrays.sort(result); return result; } ListPM();  ListPM(int initialCapacity);  ListPM(ArrayList<Entry> list); protected  ListPM(List<Entry> list); Sorter getSorter(); void setSorter(Sorter sorter); boolean isRevalidateElementsOnChangeEnabled(); void setRevalidateElementsOnChangeEnabled(boolean enabled); void addListListener(ListListener l); void removeListListener(ListListener l); void revalidateElements(); void replace(T oldElement, T newElement); void replace(int index, T newElement); void add(T element); void add(int index, T element); void addAll(Collection<T> col); boolean contains(T element); boolean containsAll(Collection<T> col); void clear(); boolean removeAll(Collection<? extends T> col); boolean remove(T element); T removeAt(int index); void swap(int indexA, int indexB); void swap(T elemA, T elemB); void reverse(); void sortBy(boolean ascending, Path... paths); void sortBy(Collection<SortKey> newSortKeys); void sortBy(SortKey... newSortKeys); Collection<SortKey> getSortKeys(); T getAt(int index); Collection<T> toCollection(); Object[] toArray(); Selection<T> getSelection(); int indexOf(T element); int[] indicesOf(Collection<? extends T> col); int size(); boolean isEmpty(); Iterator<T> iterator(); ListIterator<T> listIterator(final int index);  }