@Test public void canRemoveFromFilterIterator() { ArrayList al = new ArrayList(); al.add("foo"); Iterator i = Linqy.filter(al, new IsNotNullPredicate()).iterator(); i.next(); i.remove(); Assert.assertEquals(0, al.size()); }
public static <T> Iterable<T> filter(final Iterable<T> sequence, final Predicate<? super T> filter) { return new Iterable<T>() { @Override public Iterator<T> iterator() { return new FilteringIterator<T>(sequence.iterator(), filter); } }; }
Linqy { public static <T> Iterable<T> filter(final Iterable<T> sequence, final Predicate<? super T> filter) { return new Iterable<T>() { @Override public Iterator<T> iterator() { return new FilteringIterator<T>(sequence.iterator(), filter); } }; } }
Linqy { public static <T> Iterable<T> filter(final Iterable<T> sequence, final Predicate<? super T> filter) { return new Iterable<T>() { @Override public Iterator<T> iterator() { return new FilteringIterator<T>(sequence.iterator(), filter); } }; } private  Linqy(); }
Linqy { public static <T> Iterable<T> filter(final Iterable<T> sequence, final Predicate<? super T> filter) { return new Iterable<T>() { @Override public Iterator<T> iterator() { return new FilteringIterator<T>(sequence.iterator(), filter); } }; } private  Linqy(); static List<E> asList(Iterable<E> i); static Iterable<E> cast(final Iterable i); static Iterable<E> singleton(final E single); static Iterable<T> map(final Iterable<F> from,
                                         final Mapper<? super F, T> mapper); static Iterable<T> filter(final Iterable<T> sequence,
                                         final Predicate<? super T> filter); static int count(Iterable seq); static boolean any(final Iterable<T> sequence,
                                  final Predicate<? super T> predicate); static boolean all(final Iterable<T> sequence,
                                  final Predicate<? super T> predicate); }
Linqy { public static <T> Iterable<T> filter(final Iterable<T> sequence, final Predicate<? super T> filter) { return new Iterable<T>() { @Override public Iterator<T> iterator() { return new FilteringIterator<T>(sequence.iterator(), filter); } }; } private  Linqy(); static List<E> asList(Iterable<E> i); static Iterable<E> cast(final Iterable i); static Iterable<E> singleton(final E single); static Iterable<T> map(final Iterable<F> from,
                                         final Mapper<? super F, T> mapper); static Iterable<T> filter(final Iterable<T> sequence,
                                         final Predicate<? super T> filter); static int count(Iterable seq); static boolean any(final Iterable<T> sequence,
                                  final Predicate<? super T> predicate); static boolean all(final Iterable<T> sequence,
                                  final Predicate<? super T> predicate);  }