scala> import scala.collection.mutable.Queue import scala.collection.mutable.Queue scala> var fruits = Queue[String]() fruits: scala.collection.mutable.Queue[String] = Queue() scala> fruits += "apple" res66: scala.collection.mutable.Queue[String] = Queue(apple) scala> fruits += ("orange","banana") res67: scala.collection.mutable.Queue[String] = Queue(apple, orange, banana) scala> fruits ++= List("cherry","cocount") res68: scala.collection.mutable.Queue[String] = Queue(apple, orange, banana, cherry, cocount) scala> fruits.enqueue("pine") scala> fruits res70: scala.collection.mutable.Queue[String] = Queue(apple, orange, banana, cherry, cocount, pine)
scala的多种集合的使用(8)之队列和栈的操作方法
内容版权声明:除非注明,否则皆为本站原创文章。