You should add a Java-friendly version of this too that takes a java.util.Iterable