private Iterator < ResultWithCursor < T > > load ( final Iterator < ResultWithCursor < Key < T > > > keys ) { final List < Entry < ResultWithCursor < Key < T > > , Result < T > > > results = Lists . newArrayList ( ) ; while ( keys . hasNext ( ) ) { final ResultWithCursor < Key < T > > next = keys . next ( ) ; results . add ( Maps . immutableEntry ( next , loadEngine . load ( next . getResult ( ) ) ) ) ; } loadEngine . execute ( ) ; return Iterators . transform ( results . iterator ( ) , entry -> new ResultWithCursor <> ( entry . getValue ( ) . now ( ) , entry . getKey ( ) . getCursorAfter ( ) ) ) ; }
Loads them ; note that it s possible for some loaded results to be null