@Override public LazyContinuation<T> next() { return new LazyContinuation<T>(initial, toLazyFunction(initial, function)); } };
private synchronized void resolve() { if (lazyFunction == null) return; LazyContinuation<T> continuation = lazyFunction.next(); if (continuation == null) { empty = true; rest = F.emptyFlow(); } else { lazyFirst = continuation.nextValue(); rest = new LazyFlow<T>(continuation.nextFunction()); } lazyFunction = null; } }
@Override public LazyContinuation<T> next() { return new LazyContinuation<T>(initial, toLazyFunction(initial, function)); } };
private synchronized void resolve() { if (lazyFunction == null) return; LazyContinuation<T> continuation = lazyFunction.next(); if (continuation == null) { empty = true; rest = F.emptyFlow(); } else { lazyFirst = continuation.nextValue(); rest = new LazyFlow<T>(continuation.nextFunction()); } lazyFunction = null; } }
@Override public LazyContinuation<T> next() { if (!iterator.hasNext()) return null; return new LazyContinuation<T>(iterator.next(), this); } }
@Override public LazyContinuation<T> next() { if (!iterator.hasNext()) return null; return new LazyContinuation<T>(iterator.next(), this); } }
@Override public LazyContinuation<Integer> next() { if (delta < 0 && lower + delta < upper) return null; if (delta > 0 && lower + delta > upper) return null; return new LazyContinuation<Integer>(lower, new LazyRange(lower + delta, upper, delta)); }
@Override public LazyContinuation<Integer> next() { if (delta < 0 && lower + delta < upper) return null; if (delta > 0 && lower + delta > upper) return null; return new LazyContinuation<Integer>(lower, new LazyRange(lower + delta, upper, delta)); }
@Override public LazyContinuation<T> next() { if (valueIndex == 0) { for (Flow<T> flow : flows) { if (flow.isEmpty()) return null; } } return new LazyContinuation<T>(flows.get(valueIndex).first(), nextFunction()); }
@Override public LazyContinuation<T> next() { if (valueIndex == 0) { for (Flow<T> flow : flows) { if (flow.isEmpty()) return null; } } return new LazyContinuation<T>(flows.get(valueIndex).first(), nextFunction()); }
@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<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()) return null; return new LazyContinuation<T>(new LazyFirst<T>(flow), new LazyWalk<T>(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<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 (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)); }
@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<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())); } }