I have an android project that has its own list of arrays of objects, now I want to filter this list of arrays. But always I get zero (the size of the new list of arrays).
public static <T> List<T> filter(Matcher<?> matcher, Iterable<T> iterable) { if (iterable == null) return new LinkedList<T>(); else{ List<T> collected = new LinkedList<T>(); Iterator<T> iterator = iterable.iterator(); if (iterator == null) return collected; while (iterator.hasNext()) { T item = iterator.next(); if (matcher.matches(item)) collected.add(item); } return collected; } } ArrayList<Products> sortedArrayList = (ArrayList<Products>) filter(Matchers.anyOf( Matchers.containsString(searchText),Matchers.containsString(searchText.toUpperCase())), productList);
Why am I getting zero, please help.
source share