@Test public void clearTest() { insert(new Item(1)); insert(new Item(2)); assertEquals(2, mList.size()); mList.clear(); assertEquals(0, mList.size()); insert(new Item(3)); assertEquals(1, mList.size()); }
public void clear() { throwIfInMutationOperation(); if (mSize == 0) { return; } final int prevSize = mSize; Arrays.fill(mData, 0, prevSize, null); mSize = 0; mCallback.onRemoved(0, prevSize); }
SortedList { public void clear() { throwIfInMutationOperation(); if (mSize == 0) { return; } final int prevSize = mSize; Arrays.fill(mData, 0, prevSize, null); mSize = 0; mCallback.onRemoved(0, prevSize); } }
SortedList { public void clear() { throwIfInMutationOperation(); if (mSize == 0) { return; } final int prevSize = mSize; Arrays.fill(mData, 0, prevSize, null); mSize = 0; mCallback.onRemoved(0, prevSize); } SortedList(@NonNull Class<T> klass, @NonNull Callback<T> callback);  SortedList(@NonNull Class<T> klass, @NonNull Callback<T> callback, int initialCapacity); }
SortedList { public void clear() { throwIfInMutationOperation(); if (mSize == 0) { return; } final int prevSize = mSize; Arrays.fill(mData, 0, prevSize, null); mSize = 0; mCallback.onRemoved(0, prevSize); } SortedList(@NonNull Class<T> klass, @NonNull Callback<T> callback);  SortedList(@NonNull Class<T> klass, @NonNull Callback<T> callback, int initialCapacity); int size(); int add(T item); void addAll(@NonNull T[] items, boolean mayModifyInput); void addAll(@NonNull T... items); void addAll(@NonNull Collection<T> items); void replaceAll(@NonNull T[] items, boolean mayModifyInput); void replaceAll(@NonNull T... items); void replaceAll(@NonNull Collection<T> items); void beginBatchedUpdates(); void endBatchedUpdates(); boolean remove(T item); T removeItemAt(int index); void updateItemAt(int index, T item); void recalculatePositionOfItemAt(int index); T get(int index); int indexOf(T item); void clear(); }
SortedList { public void clear() { throwIfInMutationOperation(); if (mSize == 0) { return; } final int prevSize = mSize; Arrays.fill(mData, 0, prevSize, null); mSize = 0; mCallback.onRemoved(0, prevSize); } SortedList(@NonNull Class<T> klass, @NonNull Callback<T> callback);  SortedList(@NonNull Class<T> klass, @NonNull Callback<T> callback, int initialCapacity); int size(); int add(T item); void addAll(@NonNull T[] items, boolean mayModifyInput); void addAll(@NonNull T... items); void addAll(@NonNull Collection<T> items); void replaceAll(@NonNull T[] items, boolean mayModifyInput); void replaceAll(@NonNull T... items); void replaceAll(@NonNull Collection<T> items); void beginBatchedUpdates(); void endBatchedUpdates(); boolean remove(T item); T removeItemAt(int index); void updateItemAt(int index, T item); void recalculatePositionOfItemAt(int index); T get(int index); int indexOf(T item); void clear(); static final int INVALID_POSITION; }