/// <summary> /// 将 Steque 中的内容移动到栈中。 /// </summary> private void StequeToStack() { while (!steque.IsEmpty()) { stack.Push(steque.Pop()); } }
/// <summary> /// 将两个 Steque 连接。 /// </summary> /// <param name="s1">第一个 Steque </param> /// <param name="s2">第二个 Steque (将被删除)</param> /// <returns></returns> public static Steque <TItem> Catenation(Steque <TItem> s1, Steque <TItem> s2) { if (s1.IsEmpty()) { s1._first = s2._first; s1._last = s2._last; s1._count = s2._count; } else { s1._last.Next = s2._first; s1._count += s2._count; } return(s1); }