Skip to content
This repository was archived by the owner on Nov 9, 2017. It is now read-only.

adding removeAll to more closely mirror arraylist methods #346

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ When describing an issue, be precise:
* What happened? What do you think should have happened?
* On what Android version does this issue occur?

# Asking Questions

Asking questions should preferably be done on a dedicated forum such as [StackOverflow](http://stackoverflow.com/). This is an issue tracker after all.

# Contributing code

## Please do!
Expand All @@ -32,4 +36,4 @@ I'm happy to view and accept pull requests. However, it is important to follow t
* **Do not** put any `@author` comment. Git keeps track of all your changes and `@author` does more harm than good.
* **Do not** issue a pull request into the `master` branch.
* Try to keep the diff as small as possible. For example, be aware of auto formatting.
* All files should have the Apache 2 License header.
* All files should have the Apache 2 License header.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;

/**
Expand Down Expand Up @@ -136,6 +137,20 @@ public T remove(final int location) {
return result;
}

public boolean removeAll(@NonNull Collection<?> c) {
boolean modified = false;
Iterator<?> e = this.mItems.iterator();
while (e.hasNext()) {
if (c.contains(e.next())) {
e.remove();
modified = true;
}
}
if(modified)
this.notifyDataSetChanged();
return modified;
}

@Override
public void swapItems(final int positionOne, final int positionTwo) {
T firstItem = mItems.set(positionOne, getItem(positionTwo));
Expand Down