public bool MoveNext() { if (_remainingStack == null) { // initial move _remainingStack = _originalStack; } else if (!_remainingStack.IsEmpty) { _remainingStack = _remainingStack.Pop(); } return(!_remainingStack.IsEmpty); }
private RealTimeQueue(LazyStack forwards, ImmutableStack <T> backwards, LazyStack lazy) { Debug.Assert(forwards is { });
/// <summary> /// Initializes a new instance of the <see cref="LazyStackEnumerator"/> struct. /// </summary> /// <param name="stack">The stack to enumerator.</param> internal LazyStackEnumerator(LazyStack stack) { _originalStack = stack; _remainingStack = null; }
/// <summary> /// Resets the position to just before the first element in the list. /// </summary> public void Reset() { this.ThrowIfDisposed(); _remainingStack = null; }
/// <summary> /// Initializes a new instance of the <see cref="LazyStackEnumeratorObject"/> class. /// </summary> /// <param name="stack">The stack to enumerator.</param> internal LazyStackEnumeratorObject(LazyStack stack) { _originalStack = stack; }
/// <summary> /// Initializes a new instance of the <see cref="LazyStack"/> class. /// </summary> /// <param name="head">The head element on the stack.</param> /// <param name="tail">The rest of the elements on the stack.</param> internal LazyStack(T head, LazyStack tail) { Debug.Assert(tail is { });