public static <A, B, C> TriIterator<A, B, C> generate(final BooleanSupplier hasNext, final Consumer<Triple<A, B, C>> output) {
        N.checkArgNotNull(hasNext);
        N.checkArgNotNull(output);

        return new TriIterator<A, B, C>() {
            private final Triple<A, B, C> tmp = new Triple<A, B, C>();

            @Override
            public boolean hasNext() {
                return hasNext.getAsBoolean();
            }

            @Override
            public Triple<A, B, C> next() {
                if (hasNext() == false) {
                    throw new NoSuchElementException();
                }

                output.accept(tmp);

                return Triple.of(tmp.left, tmp.middle, tmp.right);
            }

            @Override
            public <E extends Exception> void forEachRemaining(final Try.TriConsumer<? super A, ? super B, ? super C, E> action) throws E {
                N.checkArgNotNull(action);

                while (hasNext.getAsBoolean()) {
                    output.accept(tmp);

                    action.accept(tmp.left, tmp.middle, tmp.right);
                }
            }

            @Override
            public <R> ObjIterator<R> map(final TriFunction<? super A, ? super B, ? super C, R> mapper) {
                N.checkArgNotNull(mapper);

                return new ObjIterator<R>() {
                    @Override
                    public boolean hasNext() {
                        return hasNext.getAsBoolean();
                    }

                    @Override
                    public R next() {
                        if (hasNext() == false) {
                            throw new NoSuchElementException();
                        }

                        output.accept(tmp);

                        return mapper.apply(tmp.left, tmp.middle, tmp.right);
                    }
                };
            }
        };
    }
public static < A , B , C > TriIterator < A , B , C > generate ( final BooleanSupplier hasNext , final Consumer < Triple < A , B , C > > output ) { N . checkArgNotNull ( hasNext ) ; N . checkArgNotNull ( output ) ; return new TriIterator < A , B , C > ( ) { private final Triple < A , B , C > tmp = new Triple < A , B , C > ( ) ; @ Override public boolean hasNext ( ) { return hasNext . getAsBoolean ( ) ; } @ Override public Triple < A , B , C > next ( ) { if ( hasNext ( ) == false ) { throw new NoSuchElementException ( ) ; } output . accept ( tmp ) ; return Triple . of ( tmp . left , tmp . middle , tmp . right ) ; } @ Override public < E extends Exception > void forEachRemaining ( final Try . TriConsumer < ? super A , ? super B , ? super C , E > action ) throws E { N . checkArgNotNull ( action ) ; while ( hasNext . getAsBoolean ( ) ) { output . accept ( tmp ) ; action . accept ( tmp . left , tmp . middle , tmp . right ) ; } } @ Override public < R > ObjIterator < R > map ( final TriFunction < ? super A , ? super B , ? super C , R > mapper ) { N . checkArgNotNull ( mapper ) ; return new ObjIterator < R > ( ) { @ Override public boolean hasNext ( ) { return hasNext . getAsBoolean ( ) ; } @ Override public R next ( ) { if ( hasNext ( ) == false ) { throw new NoSuchElementException ( ) ; } output . accept ( tmp ) ; return mapper . apply ( tmp . left , tmp . middle , tmp . right ) ; } } ; } } ; }
@param hasNext
@param output
@return