@Override public LazyContinuation<Tuple<A, B>> next() { if (aFlow.isEmpty() || bFlow.isEmpty()) return null; LazyZipValue<A, B> nextValue = new LazyZipValue<A, B>(aFlow, bFlow); return new LazyContinuation<Tuple<A, B>>(nextValue, new LazyZip<A, B>(aFlow.rest(), bFlow.rest())); } }
@Override public LazyContinuation<X> next() { if (flow.isEmpty()) return null; LazyValue<X> nextValue = new LazyMappedValue<T, X>(flow, mapper); return new LazyContinuation<X>(nextValue, new LazyMapper<T, X>(mapper, flow.rest())); }
@Override public LazyContinuation<T> next() { if (flow.isEmpty() || length < 1) return null; return new LazyContinuation<T>(new LazyFirst<T>(flow), new LazyTake<T>(length - 1, flow.rest())); }
@Override public LazyContinuation<T> next() { if (flow.isEmpty()) return null; return new LazyContinuation<T>(new LazyFirst<T>(flow), new LazyWalk<T>(flow.rest())); } }
@Override public LazyContinuation<Y> next() { if (left.isEmpty() || right.isEmpty()) return null; LazyValue<Y> nextValue = new LazyMapped2Value<T, X, Y>(left, right, mapper); return new LazyContinuation<Y>(nextValue, new LazyMapper2<T, X, Y>(mapper, left.rest(), right.rest())); } }
@Override public <X, Y> Flow<Y> map(Mapper2<T, X, Y> mapper, Flow<? extends X> flow) { assert mapper != null; assert flow != null; if (this.isEmpty() || flow.isEmpty()) return F.emptyFlow(); return F.lazy(new LazyMapper2<T, X, Y>(mapper, this, flow)); }
@Override public LazyContinuation<T> next() { if (flow.isEmpty()) return null; return new LazyContinuation<T>(new LazyFirst<T>(flow), new LazyWalk<T>(flow.rest())); } }
@Override public LazyContinuation<Tuple<A, B>> next() { if (aFlow.isEmpty() || bFlow.isEmpty()) return null; LazyZipValue<A, B> nextValue = new LazyZipValue<A, B>(aFlow, bFlow); return new LazyContinuation<Tuple<A, B>>(nextValue, new LazyZip<A, B>(aFlow.rest(), bFlow.rest())); } }
@Override public LazyContinuation<X> next() { if (flow.isEmpty()) return null; LazyValue<X> nextValue = new LazyMappedValue<T, X>(flow, mapper); return new LazyContinuation<X>(nextValue, new LazyMapper<T, X>(mapper, flow.rest())); }
@Override public LazyContinuation<T> next() { if (flow.isEmpty() || length < 1) return null; return new LazyContinuation<T>(new LazyFirst<T>(flow), new LazyTake<T>(length - 1, flow.rest())); }
@Override public LazyContinuation<Y> next() { if (left.isEmpty() || right.isEmpty()) return null; LazyValue<Y> nextValue = new LazyMapped2Value<T, X, Y>(left, right, mapper); return new LazyContinuation<Y>(nextValue, new LazyMapper2<T, X, Y>(mapper, left.rest(), right.rest())); } }
@Override public <X, Y> Flow<Y> map(Mapper2<T, X, Y> mapper, Flow<? extends X> flow) { assert mapper != null; assert flow != null; if (this.isEmpty() || flow.isEmpty()) return F.emptyFlow(); return F.lazy(new LazyMapper2<T, X, Y>(mapper, this, flow)); }
@Override public LazyContinuation<T> next() { if (left.isEmpty()) { if (right.isEmpty()) return null; return new LazyContinuation<T>(new LazyFirst<T>(right), new LazyWalk<T>(right.rest())); } return new LazyContinuation<T>(new LazyFirst<T>(left), new LazyConcat<T>(left.rest(), right)); }
@Override public LazyContinuation<T> next() { if (left.isEmpty()) { if (right.isEmpty()) return null; return new LazyContinuation<T>(new LazyFirst<T>(right), new LazyWalk<T>(right.rest())); } return new LazyContinuation<T>(new LazyFirst<T>(left), new LazyConcat<T>(left.rest(), right)); }