@Test public void testRemoveAll() { list.add(asArray(0, 1, 0, 1, 0)); assertEquals(0, list.removeAll(k2)); assertEquals(3, list.removeAll(k0)); assertListEquals(list.toArray(), 1, 1); assertEquals(2, list.removeAll(k1)); assertTrue(list.isEmpty()); list.clear(); list.add(newArray(k0, null, k2, null, k0)); assertEquals(2, list.removeAll((KType) null)); assertEquals(0, list.removeAll((KType) null)); assertListEquals(list.toArray(), 0, 2, 0); }
@Override public int removeAll(KType e1) { int to = 0; for (int from = 0; from < elementsCount; from++) { if (Intrinsics.equals(this, e1, buffer[from])) { buffer[from] = Intrinsics.empty(); continue; } if (to != from) { buffer[to] = buffer[from]; buffer[from] = Intrinsics.empty(); } to++; } final int deleted = elementsCount - to; this.elementsCount = to; return deleted; }
KTypeArrayList extends AbstractKTypeCollection<KType> implements KTypeIndexedContainer<KType>,
             Preallocable,
             Cloneable,
             Accountable { @Override public int removeAll(KType e1) { int to = 0; for (int from = 0; from < elementsCount; from++) { if (Intrinsics.equals(this, e1, buffer[from])) { buffer[from] = Intrinsics.empty(); continue; } if (to != from) { buffer[to] = buffer[from]; buffer[from] = Intrinsics.empty(); } to++; } final int deleted = elementsCount - to; this.elementsCount = to; return deleted; } }
KTypeArrayList extends AbstractKTypeCollection<KType> implements KTypeIndexedContainer<KType>,
             Preallocable,
             Cloneable,
             Accountable { @Override public int removeAll(KType e1) { int to = 0; for (int from = 0; from < elementsCount; from++) { if (Intrinsics.equals(this, e1, buffer[from])) { buffer[from] = Intrinsics.empty(); continue; } if (to != from) { buffer[to] = buffer[from]; buffer[from] = Intrinsics.empty(); } to++; } final int deleted = elementsCount - to; this.elementsCount = to; return deleted; } KTypeArrayList();  KTypeArrayList(int expectedElements);  KTypeArrayList(int expectedElements, ArraySizingStrategy resizer);  KTypeArrayList(KTypeContainer<? extends KType> container); }
KTypeArrayList extends AbstractKTypeCollection<KType> implements KTypeIndexedContainer<KType>,
             Preallocable,
             Cloneable,
             Accountable { @Override public int removeAll(KType e1) { int to = 0; for (int from = 0; from < elementsCount; from++) { if (Intrinsics.equals(this, e1, buffer[from])) { buffer[from] = Intrinsics.empty(); continue; } if (to != from) { buffer[to] = buffer[from]; buffer[from] = Intrinsics.empty(); } to++; } final int deleted = elementsCount - to; this.elementsCount = to; return deleted; } KTypeArrayList();  KTypeArrayList(int expectedElements);  KTypeArrayList(int expectedElements, ArraySizingStrategy resizer);  KTypeArrayList(KTypeContainer<? extends KType> container); @Override void add(KType e1); void add(KType e1, KType e2); void add(KType[] elements, int start, int length); @SafeVarargs /* #end */ final void add(KType... elements); int addAll(KTypeContainer<? extends KType> container); int addAll(Iterable<? extends KTypeCursor<? extends KType>> iterable); @Override void insert(int index, KType e1); @Override KType get(int index); @Override KType set(int index, KType e1); @Override KType remove(int index); @Override void removeRange(int fromIndex, int toIndex); @Override int removeFirst(KType e1); @Override int removeLast(KType e1); @Override int removeAll(KType e1); @Override boolean contains(KType e1); @Override int indexOf(KType e1); @Override int lastIndexOf(KType e1); @Override boolean isEmpty(); @Override void ensureCapacity(int expectedElements); void resize(int newSize); @Override int size(); void trimToSize(); @Override void clear(); @Override void release(); @Override /*! #if ($TemplateOptions.KTypePrimitive) KType [] toArray() #else !*/ Object [] toArray(); @Override KTypeArrayList<KType> clone(); @Override int hashCode(); @Override boolean equals(Object obj); @Override long ramBytesAllocated(); @Override long ramBytesUsed(); @Override Iterator<KTypeCursor<KType>> iterator(); @Override T forEach(T procedure); T forEach(T procedure, int fromIndex, final int toIndex); @Override int removeAll(KTypePredicate<? super KType> predicate); @Override T forEach(T predicate); T forEach(T predicate, int fromIndex, final int toIndex); @SafeVarargs /* #end */ static KTypeArrayList<KType> from(KType... elements); }
KTypeArrayList extends AbstractKTypeCollection<KType> implements KTypeIndexedContainer<KType>,
             Preallocable,
             Cloneable,
             Accountable { @Override public int removeAll(KType e1) { int to = 0; for (int from = 0; from < elementsCount; from++) { if (Intrinsics.equals(this, e1, buffer[from])) { buffer[from] = Intrinsics.empty(); continue; } if (to != from) { buffer[to] = buffer[from]; buffer[from] = Intrinsics.empty(); } to++; } final int deleted = elementsCount - to; this.elementsCount = to; return deleted; } KTypeArrayList();  KTypeArrayList(int expectedElements);  KTypeArrayList(int expectedElements, ArraySizingStrategy resizer);  KTypeArrayList(KTypeContainer<? extends KType> container); @Override void add(KType e1); void add(KType e1, KType e2); void add(KType[] elements, int start, int length); @SafeVarargs /* #end */ final void add(KType... elements); int addAll(KTypeContainer<? extends KType> container); int addAll(Iterable<? extends KTypeCursor<? extends KType>> iterable); @Override void insert(int index, KType e1); @Override KType get(int index); @Override KType set(int index, KType e1); @Override KType remove(int index); @Override void removeRange(int fromIndex, int toIndex); @Override int removeFirst(KType e1); @Override int removeLast(KType e1); @Override int removeAll(KType e1); @Override boolean contains(KType e1); @Override int indexOf(KType e1); @Override int lastIndexOf(KType e1); @Override boolean isEmpty(); @Override void ensureCapacity(int expectedElements); void resize(int newSize); @Override int size(); void trimToSize(); @Override void clear(); @Override void release(); @Override /*! #if ($TemplateOptions.KTypePrimitive) KType [] toArray() #else !*/ Object [] toArray(); @Override KTypeArrayList<KType> clone(); @Override int hashCode(); @Override boolean equals(Object obj); @Override long ramBytesAllocated(); @Override long ramBytesUsed(); @Override Iterator<KTypeCursor<KType>> iterator(); @Override T forEach(T procedure); T forEach(T procedure, int fromIndex, final int toIndex); @Override int removeAll(KTypePredicate<? super KType> predicate); @Override T forEach(T predicate); T forEach(T predicate, int fromIndex, final int toIndex); @SafeVarargs /* #end */ static KTypeArrayList<KType> from(KType... elements); final static Object [] EMPTY_ARRAY; public Object [] buffer; public int elementsCount; }