【问题标题】:save stack in arraylist在arraylist中保存堆栈
【发布时间】:2009-04-20 12:31:16
【问题描述】:

我想知道如何将堆栈保存在数组列表中?

【问题讨论】:

  • 您使用什么语言?爪哇?

标签: data-structures shared-libraries


【解决方案1】:

在 C# 3.0 中,你会这样做:

var list = stack.ToList();  // Returns List<T>

【讨论】:

    【解决方案2】:
    System.Collections.Generic.Stack<int> myStack = new Stack<int>();
    System.Collections.ArrayList myList = new System.Collections.ArrayList(myStack);
    

    【讨论】:

      猜你喜欢
      • 2012-11-28
      • 1970-01-01
      • 1970-01-01
      • 2015-04-03
      • 1970-01-01
      • 1970-01-01
      • 2011-06-23
      • 1970-01-01
      • 2013-12-06
      相关资源
      最近更新 更多