We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 2ab3e89 + 4c85406 commit edb2c2fCopy full SHA for edb2c2f
library/src/scala/collection/generic/GenericCompanion.scala
@@ -39,7 +39,10 @@ abstract class GenericCompanion[+CC[X] <: GenTraversable[X]] {
39
/** An empty collection of type `$Coll[A]`
40
* @tparam A the type of the ${coll}'s elements
41
*/
42
- def empty[A]: CC[A] = newBuilder[A].result()
+ def empty[A]: CC[A] = {
43
+ if ((this eq immutable.Seq) || (this eq collection.Seq)) Nil.asInstanceOf[CC[A]]
44
+ else newBuilder[A].result()
45
+ }
46
47
/** Creates a $coll with the specified elements.
48
0 commit comments