/** * Create an iterator over an infinite number monotonically increasing numbers starting at the given number, useful when * performing an operation an unknown number of times. * * @param startingAt the first number to include in the resulting stream * @return the sequence; never null */ public static Iterable<Integer> infiniteIntegers(int startingAt) { return Iterators.around(new Iterator<Integer>() { private int counter = startingAt; @Override public boolean hasNext() { return true; } @Override public Integer next() { return Integer.valueOf(counter++); } }); }
public static <V, T> Iterator<T> around(final Iterable<? extends V> iterable, Function<V, T> conversion) { return around(iterable.iterator(), conversion); }
@Override public Iterator<Field> iterator() { return Iterators.around(fields.entrySet(), CONVERT_ENTRY_TO_FIELD); }
public static <T, U, V> Iterator<V> around(Iterable<? extends T> first, Iterable<? extends U> second, BiFunction<T, U, V> conversion) { return around(first.iterator(), second.iterator(), conversion); }
@Override public Iterator<Entry> iterator() { return Iterators.around(Sequences.infiniteIntegers(0), values, CONVERT_PAIR_TO_ENTRY); }
/** * Create an iterator over an infinite number monotonically increasing numbers starting at the given number, useful when * performing an operation an unknown number of times. * * @param startingAt the first number to include in the resulting stream * @return the sequence; never null */ public static Iterable<Integer> infiniteIntegers(int startingAt) { return Iterators.around(new Iterator<Integer>() { private int counter = startingAt; @Override public boolean hasNext() { return true; } @Override public Integer next() { return Integer.valueOf(counter++); } }); }
@Override public Iterator<Field> iterator() { return Iterators.around(fields.entrySet(), CONVERT_ENTRY_TO_FIELD); }
public static <V, T> Iterator<T> around(final Iterable<? extends V> iterable, Function<V, T> conversion) { return around(iterable.iterator(), conversion); }
public static <T, U, V> Iterator<V> around(Iterable<? extends T> first, Iterable<? extends U> second, BiFunction<T, U, V> conversion) { return around(first.iterator(), second.iterator(), conversion); }
@Override public Iterator<Entry> iterator() { return Iterators.around(Sequences.infiniteIntegers(0), values, CONVERT_PAIR_TO_ENTRY); }