@Test public void shouldReturnAFunctionFromIterableToIteratorKeepingNull() { Iterable<String> iterable = iterableWith("1", "2", "3"); Iterator<? extends String> firstIterator = fromIterableToIteratorKeepingNull(String.class).call(iterable); Iterator<? extends String> secondIterator = fromIterableToIteratorKeepingNull(String.class).call(iterable); assertThat(firstIterator.next(), is("1")); assertThat(secondIterator.next(), is("1")); assertThat(secondIterator.next(), is("2")); assertThat(firstIterator.next(), is("2")); assertThat(firstIterator.next(), is("3")); assertThat(secondIterator.next(), is("3")); }
public static <T> UnaryFunction<Iterable<? extends T>, Iterator<? extends T>> fromIterableToIteratorKeepingNull() { return new UnaryFunction<Iterable<? extends T>, Iterator<? extends T>>() { @Override public Iterator<? extends T> call(Iterable<? extends T> iterable) { return option(iterable).map(Iterators.<T>fromIterableToIterator()).getOrElse(Literals.<T>iteratorWith(null)); } }; }
Iterators { public static <T> UnaryFunction<Iterable<? extends T>, Iterator<? extends T>> fromIterableToIteratorKeepingNull() { return new UnaryFunction<Iterable<? extends T>, Iterator<? extends T>>() { @Override public Iterator<? extends T> call(Iterable<? extends T> iterable) { return option(iterable).map(Iterators.<T>fromIterableToIterator()).getOrElse(Literals.<T>iteratorWith(null)); } }; } }
Iterators { public static <T> UnaryFunction<Iterable<? extends T>, Iterator<? extends T>> fromIterableToIteratorKeepingNull() { return new UnaryFunction<Iterable<? extends T>, Iterator<? extends T>>() { @Override public Iterator<? extends T> call(Iterable<? extends T> iterable) { return option(iterable).map(Iterators.<T>fromIterableToIterator()).getOrElse(Literals.<T>iteratorWith(null)); } }; } private  Iterators(); }
Iterators { public static <T> UnaryFunction<Iterable<? extends T>, Iterator<? extends T>> fromIterableToIteratorKeepingNull() { return new UnaryFunction<Iterable<? extends T>, Iterator<? extends T>>() { @Override public Iterator<? extends T> call(Iterable<? extends T> iterable) { return option(iterable).map(Iterators.<T>fromIterableToIterator()).getOrElse(Literals.<T>iteratorWith(null)); } }; } private  Iterators(); static Iterator<T> emptyIterator(); static Iterable<T> asIterable(Iterator<T> iterator); static List<T> asList(Iterator<? extends T> iterator); static Set<T> asSet(Iterator<? extends T> iterator); static Multiset<T> asMultiset(Iterator<? extends T> iterator); static UnaryFunction<? super Iterable<? extends T>, Iterator<? extends T>> fromIterableToIterator(); static UnaryFunction<? super Iterable<? extends T>, Iterator<? extends T>> fromIterableToIterator(Class<T> ofKlass); static UnaryFunction<Iterable<? extends T>, Iterator<? extends T>> fromIterableToIteratorKeepingNull(); static UnaryFunction<Iterable<? extends T>, Iterator<? extends T>> fromIterableToIteratorKeepingNull(Class<T> ofKlass); }
Iterators { public static <T> UnaryFunction<Iterable<? extends T>, Iterator<? extends T>> fromIterableToIteratorKeepingNull() { return new UnaryFunction<Iterable<? extends T>, Iterator<? extends T>>() { @Override public Iterator<? extends T> call(Iterable<? extends T> iterable) { return option(iterable).map(Iterators.<T>fromIterableToIterator()).getOrElse(Literals.<T>iteratorWith(null)); } }; } private  Iterators(); static Iterator<T> emptyIterator(); static Iterable<T> asIterable(Iterator<T> iterator); static List<T> asList(Iterator<? extends T> iterator); static Set<T> asSet(Iterator<? extends T> iterator); static Multiset<T> asMultiset(Iterator<? extends T> iterator); static UnaryFunction<? super Iterable<? extends T>, Iterator<? extends T>> fromIterableToIterator(); static UnaryFunction<? super Iterable<? extends T>, Iterator<? extends T>> fromIterableToIterator(Class<T> ofKlass); static UnaryFunction<Iterable<? extends T>, Iterator<? extends T>> fromIterableToIteratorKeepingNull(); static UnaryFunction<Iterable<? extends T>, Iterator<? extends T>> fromIterableToIteratorKeepingNull(Class<T> ofKlass);  }