class LeftJoinNLBatchIterator<L, R, C> extends JoinBatchIterator<L, R, C> {

    private final Predicate<C> joinCondition;
    private boolean hadMatch = false;

    public LeftJoinNLBatchIterator(BatchIterator<L> left,
                                   BatchIterator<R> right,
                                   ElementCombiner<L, R, C> combiner,
                                   Predicate<C> joinCondition) {
        super(left, right, combiner);
        this.joinCondition = joinCondition;
    }

    @Override
    public boolean moveNext() {
        while (true) {
            if (activeIt == left) {
                return moveLeftSide();
            }

            Boolean x = tryAdvanceRight();
            if (x != null) {
                return x;
            }
            activeIt = left;
        }
    }

    private boolean moveLeftSide() {
        activeIt = right;
        while (tryMoveLeft()) {
            Boolean x = tryAdvanceRight();
            if (x != null) {
                return x;
            }
        }
        activeIt = left;
        return false;
    }

    /**
     * try to move the right side
     *
     * @return true  -> moved and matched
     * false -> need to load more data
     * null  -> reached it's end and moved back to start -> left side needs to continue
     */
    private Boolean tryAdvanceRight() {<FILL_FUNCTION_BODY>}
}

        while (tryMoveRight()) {
            if (joinCondition.test(combiner.currentElement())) {
                hadMatch = true;
                return true;
            }
        }
        if (right.allLoaded() == false) {
            return false;
        }
        right.moveToStart();
        if (hadMatch == false) {
            activeIt = left;
            combiner.nullRight();
            return true;
        }
        hadMatch = false;
        return null;
    
<methods>public boolean allLoaded() ,public void close() ,public C currentElement() ,public boolean hasLazyResultSet() ,public void kill(java.lang.Throwable) ,public CompletionStage<?> loadNextBatch() throws java.lang.Exception,public void moveToStart() <variables>protected BatchIterator<?> activeIt,protected final non-sealed ElementCombiner<L,R,C> combiner,protected final non-sealed BatchIterator<L> left,protected final non-sealed BatchIterator<R> right