var seq = Seq[String]()
seq = seq :+ "hello"
var set = Set[String]()
set += "hello"
Seq和Set有什么区别?
最佳答案
序号
http://www.scala-lang.org/api/current/scala/collection/Seq.html
Sequences always have a defined order of elements. Sequences provide a method apply for indexing.
Seq
与java.util.List
相似。放
http://www.scala-lang.org/api/current/scala/collection/Set.html
A set is a collection that contains no duplicate elements.
这在数学意义上非常类似于“集合”:http://en.wikipedia.org/wiki/Set_(mathematics)
Set
与java.util.Set
相似。
关于scala - Scala中的Seq和Set有什么区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19803158/