Skip to content

Instantly share code, notes, and snippets.

@SG-K

SG-K/gist2.java Secret

Created July 22, 2020 13:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SG-K/970af981d34b4c4adf99b58cb77e2a2a to your computer and use it in GitHub Desktop.
Save SG-K/970af981d34b4c4adf99b58cb77e2a2a to your computer and use it in GitHub Desktop.
public class GenreFilter extends Filter<Integer> implements Filterable {
@Override
public ArrayList<Item> applyFilter(ArrayList<Item> arrayList) {
if (value == null) {
return arrayList;
} else {
ArrayList<Item> newArrayList = new ArrayList<>();
for (int i = 0; i < arrayList.size(); i++) {
int tmp = arrayList.get(i).getGenreID();
if (tmp == value)
newArrayList.add(arrayList.get(i));
}
return newArrayList;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment