GraphFrameToIterableRow implements Function<GraphFrame, Iterable<? extends Row>> { @Override public Iterable<Row> apply(final GraphFrame graphFrame) { final Iterator<Row> vertices = graphFrame.vertices().toLocalIterator(); final Iterator<Row> edges = graphFrame.edges().toLocalIterator(); return () -> Iterators.concat(vertices, edges); }  @Override Iterable<Row> apply(final GraphFrame graphFrame);  }
@Test public void shouldConvertGraphFrameToIterableOfRows() { final SparkSession sparkSession = SparkSessionProvider.getSparkSession(); final Function<GraphFrame, Iterable<? extends Row>> function = new GraphFrameToIterableRow(); final GraphFrame graphFrame = Graphs$.MODULE$.friends(); final Iterable<? extends Row> result = function.apply(graphFrame); final List<Row> resultList = Lists.newArrayList(result); assertThat(resultList, hasSize(15)); }