Skip to content

Commit

Permalink
renamed BuilderFactory[El, To, From] -> CanBuil...
Browse files Browse the repository at this point in the history
renamed BuilderFactory[El, To, From] -> CanBuildFrom[From, El, To] and
added apply() overload to create collections from scratch generically

added def apply() overload to BuilderFactory so that we can also create collections from scratch generically
(see test test/files/pos/collectGenericCC.scala)

renaming:
- BuilderFactory[El, To, From] -> CanBuildFrom[From, El, To]
    bulk type-param reordering using: s/CanBuildFrom\[\s*([^,()\s]*)\s*,(\s+[^\s,()]*)\s*,\s+([^\s,()]*)\s*\]/CanBuildFrom[$3, $1,$2]/
    some argument lists got mixed up because they contained 4 comma's...
- builderFactory -> canBuildFrom

removed explicit implicit value in DocDriver that was
renamed renamed collection/generic/BuilderFactory.scala ->
collection/generic/CanBuildFrom.scala

tested with clean build using ant strap.done -- everything went well on my machine
  • Loading branch information
adriaanm committed Oct 21, 2009
1 parent 70bc8f9 commit f818b44
Show file tree
Hide file tree
Showing 81 changed files with 304 additions and 167 deletions.
2 changes: 1 addition & 1 deletion src/compiler/scala/tools/nsc/doc/DefaultDocDriver.scala
Expand Up @@ -140,7 +140,7 @@ abstract class DefaultDocDriver extends DocDriver with ModelFrames with ModelToX
if (idx == -1) str;
else str.substring(idx + 1);
}+ ")");
else NodeSeq.Empty) ++ super.optional(cls))(NodeSeq.builderFactory)
else NodeSeq.Empty) ++ super.optional(cls))//(NodeSeq.builderFactory)
}

}
Expand Down
14 changes: 9 additions & 5 deletions src/library/scala/Array.scala
Expand Up @@ -27,12 +27,13 @@ class FallbackArrayBuilding {
* Called instead of Array.newBuilder if the element type of an array
* does not have a class manifest. Note that fallbackBuilder fcatory
* needs an implicit parameter (otherwise it would not be dominated in implicit search
* by Array.builderFactory). We make sure that that implicit search is always
* by Array.canBuildFrom). We make sure that that implicit search is always
* succesfull.
*/
implicit def fallbackBuilderFactory[T](implicit m: DummyImplicit): BuilderFactory[T, GenericArray[T], Array[_]] =
new BuilderFactory[T, GenericArray[T], Array[_]] {
implicit def fallbackCanBuildFrom[T](implicit m: DummyImplicit): CanBuildFrom[Array[_], T, GenericArray[T]] =
new CanBuildFrom[Array[_], T, GenericArray[T]] {
def apply(from: Array[_]) = GenericArray.newBuilder[T]
def apply() = GenericArray.newBuilder[T]
}
}

Expand All @@ -46,8 +47,11 @@ object Array extends FallbackArrayBuilding {
import runtime.BoxedArray;
import scala.runtime.ScalaRunTime.boxArray;

implicit def builderFactory[T](implicit m: ClassManifest[T]): BuilderFactory[T, Array[T], Array[_]] =
new BuilderFactory[T, Array[T], Array[_]] { def apply(from: Array[_]) = ArrayBuilder.make[T]()(m) }
implicit def canBuildFrom[T](implicit m: ClassManifest[T]): CanBuildFrom[Array[_], T, Array[T]] =
new CanBuildFrom[Array[_], T, Array[T]] {
def apply(from: Array[_]) = ArrayBuilder.make[T]()(m)
def apply() = ArrayBuilder.make[T]()(m)
}

def newBuilder[T](implicit m: ClassManifest[T]): ArrayBuilder[T] = ArrayBuilder.make[T]()(m)

Expand Down
8 changes: 6 additions & 2 deletions src/library/scala/Enumeration.scala
Expand Up @@ -14,7 +14,7 @@ package scala
import scala.collection.SetLike
import scala.collection.mutable.{Builder, AddingBuilder, Map, HashMap}
import scala.collection.immutable.{Set, BitSet}
import scala.collection.generic.BuilderFactory
import scala.collection.generic.CanBuildFrom

/** <p>
* Defines a finite set of values specific to the enumeration. Typically
Expand Down Expand Up @@ -233,7 +233,11 @@ abstract class Enumeration(initial: Int, names: String*) {
/** A builder object for value sets */
def newBuilder: Builder[Value, ValueSet] = new AddingBuilder(empty)
/** The implicit builder for value sets */
implicit def builderFactory: BuilderFactory[Value, ValueSet, ValueSet] = new BuilderFactory[Value, ValueSet, ValueSet] { def apply(from: ValueSet) = newBuilder }
implicit def canBuildFrom: CanBuildFrom[ValueSet, Value, ValueSet] =
new CanBuildFrom[ValueSet, Value, ValueSet] {
def apply(from: ValueSet) = newBuilder
def apply() = newBuilder
}
}

/** The name of this enumeration. */
Expand Down
7 changes: 4 additions & 3 deletions src/library/scala/LowPriorityImplicits.scala
Expand Up @@ -13,7 +13,7 @@ package scala

import collection.mutable._
import collection.immutable.{WrappedString, Vector}
import collection.generic.BuilderFactory
import collection.generic.CanBuildFrom

/** The `LowPriorityImplicits` class provides implicit values that
* are valid in all Scala compilation units without explicit qualification,
Expand Down Expand Up @@ -42,9 +42,10 @@ class LowPriorityImplicits {
implicit def wrapString(s: String): WrappedString = new WrappedString(s)
implicit def unwrapString(ws: WrappedString): String = ws.self

implicit def fallbackStringBuilderFactory[T]: BuilderFactory[T, collection.immutable.Vector[T], String] =
new BuilderFactory[T, collection.immutable.Vector[T], String] {
implicit def fallbackStringCanBuildFrom[T]: CanBuildFrom[String, T, collection.immutable.Vector[T]] =
new CanBuildFrom[String, T, collection.immutable.Vector[T]] {
def apply(from: String) = scala.collection.immutable.Vector.newBuilder[T]
def apply() = scala.collection.immutable.Vector.newBuilder[T]
}

/** Can go away after next newstarr */
Expand Down
13 changes: 8 additions & 5 deletions src/library/scala/Predef.scala
Expand Up @@ -13,7 +13,7 @@ package scala

import collection.immutable.StringOps
import collection.mutable.ArrayOps
import collection.generic.BuilderFactory
import collection.generic.CanBuildFrom

/** The <code>Predef</code> object provides definitions that are
* accessible in all Scala compilation units without explicit
Expand Down Expand Up @@ -215,8 +215,11 @@ object Predef extends LowPriorityImplicits {
implicit def augmentString(x: String): StringOps = new StringOps(x)
implicit def unaugmentString(x: StringOps): String = x.repr

implicit def stringBuilderFactory: BuilderFactory[Char, String, String] =
new BuilderFactory[Char, String, String] { def apply(from: String) = new scala.collection.mutable.StringBuilder }
implicit def stringCanBuildFrom: CanBuildFrom[String, Char, String] =
new CanBuildFrom[String, Char, String] {
def apply(from: String) = new scala.collection.mutable.StringBuilder
def apply() = new scala.collection.mutable.StringBuilder
}

implicit def any2stringadd(x: Any) = new runtime.StringAdd(x)

Expand Down Expand Up @@ -309,14 +312,14 @@ object Predef extends LowPriorityImplicits {
implicit def conforms[A]: A <:< A = new (A <:< A) {def convert(x: A) = x}

/** A type for which there is aways an implicit value.
* @see fallbackBuilderFactory in Array.scala
* @see fallbackCanBuildFrom in Array.scala
*/
class DummyImplicit

object DummyImplicit {

/** An implicit value yielding a DummyImplicit.
* @see fallbackBuilderFactory in Array.scala
* @see fallbackCanBuildFrom in Array.scala
*/
implicit def dummyImplicit: DummyImplicit = new DummyImplicit
}
Expand Down
5 changes: 4 additions & 1 deletion src/library/scala/collection/Iterable.scala
Expand Up @@ -66,7 +66,10 @@ trait Iterable[+A] extends Traversable[A]
*/
object Iterable extends TraversableFactory[Iterable] {

implicit def builderFactory[A]: BuilderFactory[A, Iterable[A], Coll] = new VirtualBuilderFactory[A]
implicit def canBuildFrom[A]: CanBuildFrom[Coll, A, Iterable[A]] =
new GenericCanBuildFrom[A] {
def apply() = newBuilder[A]
}
def newBuilder[A]: Builder[A, Iterable[A]] = immutable.Iterable.newBuilder[A]

/** The minimum element of a non-empty sequence of ordered elements */
Expand Down
6 changes: 3 additions & 3 deletions src/library/scala/collection/IterableLike.scala
Expand Up @@ -259,7 +259,7 @@ self =>
* If one of the two iterables is longer than the other, its remaining elements are ignored.
* @param that The iterable providing the second half of each result pair
*/
def zip[A1 >: A, B, That](that: Iterable[B])(implicit bf: BuilderFactory[(A1, B), That, Repr]): That = {
def zip[A1 >: A, B, That](that: Iterable[B])(implicit bf: CanBuildFrom[Repr, (A1, B), That]): That = {
val b = bf(repr)
val these = this.iterator
val those = that.iterator
Expand Down Expand Up @@ -288,7 +288,7 @@ self =>
* invoked where <code>m &gt; n</code>.
*
*/
def zipAll[B, A1 >: A, That](that: Iterable[B], thisElem: A1, thatElem: B)(implicit bf: BuilderFactory[(A1, B), That, Repr]): That = {
def zipAll[B, A1 >: A, That](that: Iterable[B], thisElem: A1, thatElem: B)(implicit bf: CanBuildFrom[Repr, (A1, B), That]): That = {
val b = bf(repr)
val these = this.iterator
val those = that.iterator
Expand All @@ -303,7 +303,7 @@ self =>

/** Zips this iterable with its indices (startiong from 0).
*/
def zipWithIndex[A1 >: A, That](implicit bf: BuilderFactory[(A1, Int), That, Repr]): That = {
def zipWithIndex[A1 >: A, That](implicit bf: CanBuildFrom[Repr, (A1, Int), That]): That = {
val b = bf(repr)
var i = 0
for (x <- this) {
Expand Down
6 changes: 3 additions & 3 deletions src/library/scala/collection/IterableProxyLike.scala
Expand Up @@ -34,9 +34,9 @@ trait IterableProxyLike[+A, +This <: IterableLike[A, This] with Iterable[A]]
override def foldRight[B](z: B)(op: (A, B) => B): B = self.foldRight(z)(op)
override def reduceRight[B >: A](op: (A, B) => B): B = self.reduceRight(op)
override def toIterable: Iterable[A] = self.toIterable
override def zip[A1 >: A, B, That](that: Iterable[B])(implicit bf: BuilderFactory[(A1, B), That, This]): That = self.zip[A1, B, That](that)(bf)
override def zipAll[B, A1 >: A, That](that: Iterable[B], thisElem: A1, thatElem: B)(implicit bf: BuilderFactory[(A1, B), That, This]): That = self.zipAll(that, thisElem, thatElem)(bf)
override def zipWithIndex[A1 >: A, That](implicit bf: BuilderFactory[(A1, Int), That, This]): That = self.zipWithIndex(bf)
override def zip[A1 >: A, B, That](that: Iterable[B])(implicit bf: CanBuildFrom[This, (A1, B), That]): That = self.zip[A1, B, That](that)(bf)
override def zipAll[B, A1 >: A, That](that: Iterable[B], thisElem: A1, thatElem: B)(implicit bf: CanBuildFrom[This, (A1, B), That]): That = self.zipAll(that, thisElem, thatElem)(bf)
override def zipWithIndex[A1 >: A, That](implicit bf: CanBuildFrom[This, (A1, Int), That]): That = self.zipWithIndex(bf)
override def head: A = self.head
override def takeRight(n: Int): This = self.takeRight(n)
override def dropRight(n: Int): This = self.dropRight(n)
Expand Down
6 changes: 5 additions & 1 deletion src/library/scala/collection/IterableView.scala
Expand Up @@ -24,5 +24,9 @@ trait IterableView[+A, +Coll] extends IterableViewLike[A, Coll, IterableView[A,

object IterableView {
type Coll = TraversableView[_, C] forSome {type C <: Traversable[_]}
implicit def builderFactory[A]: BuilderFactory[A, IterableView[A, Iterable[_]], Coll] = new BuilderFactory[A, IterableView[A, Iterable[_]], Coll] { def apply(from: Coll) = new NoBuilder }
implicit def canBuildFrom[A]: CanBuildFrom[Coll, A, IterableView[A, Iterable[_]]] =
new CanBuildFrom[Coll, A, IterableView[A, Iterable[_]]] {
def apply(from: Coll) = new NoBuilder
def apply() = new NoBuilder
}
}
6 changes: 3 additions & 3 deletions src/library/scala/collection/IterableViewLike.scala
Expand Up @@ -70,17 +70,17 @@ extends Iterable[A] with IterableLike[A, This] with TraversableView[A, Coll] wit
self.iterator.zipAll(other.iterator, thisElem, thatElem)
}

override def zip[A1 >: A, B, That](that: Iterable[B])(implicit bf: BuilderFactory[(A1, B), That, This]): That = {
override def zip[A1 >: A, B, That](that: Iterable[B])(implicit bf: CanBuildFrom[This, (A1, B), That]): That = {
newZipped(that).asInstanceOf[That]
// was: val b = bf(repr)
// if (b.isInstanceOf[NoBuilder[_]]) newZipped(that).asInstanceOf[That]
// else super.zip[A1, B, That](that)(bf)
}

override def zipWithIndex[A1 >: A, That](implicit bf: BuilderFactory[(A1, Int), That, This]): That =
override def zipWithIndex[A1 >: A, That](implicit bf: CanBuildFrom[This, (A1, Int), That]): That =
zip[A1, Int, That](Stream from 0)(bf)

override def zipAll[B, A1 >: A, That](that: Iterable[B], thisElem: A1, thatElem: B)(implicit bf: BuilderFactory[(A1, B), That, This]): That =
override def zipAll[B, A1 >: A, That](that: Iterable[B], thisElem: A1, thatElem: B)(implicit bf: CanBuildFrom[This, (A1, B), That]): That =
newZippedAll(that, thisElem, thatElem).asInstanceOf[That]

protected def newZipped[B](that: Iterable[B]): Transformed[(A, B)] = new Zipped[B] {
Expand Down
5 changes: 4 additions & 1 deletion src/library/scala/collection/LinearSeq.scala
Expand Up @@ -38,6 +38,9 @@ trait LinearSeq[+A] extends Seq[A]
* @since 2.8
*/
object LinearSeq extends SeqFactory[LinearSeq] {
implicit def builderFactory[A]: BuilderFactory[A, LinearSeq[A], Coll] = new VirtualBuilderFactory[A]
implicit def canBuildFrom[A]: CanBuildFrom[Coll, A, LinearSeq[A]] =
new GenericCanBuildFrom[A] {
def apply() = newBuilder[A]
}
def newBuilder[A]: Builder[A, LinearSeq[A]] = immutable.LinearSeq.newBuilder[A]
}
2 changes: 1 addition & 1 deletion src/library/scala/collection/Map.scala
Expand Up @@ -50,5 +50,5 @@ trait Map[A, +B] extends Iterable[(A, B)] with MapLike[A, B, Map[A, B]] {
*/
object Map extends ImmutableMapFactory[immutable.Map] {
def empty[A, B]: immutable.Map[A, B] = immutable.Map.empty
implicit def builderFactory[A, B]: BuilderFactory[(A, B), Map[A, B], Coll] = new MapBuilderFactory[A, B]
implicit def canBuildFrom[A, B]: CanBuildFrom[Coll, (A, B), Map[A, B]] = new MapCanBuildFrom[A, B]
}
5 changes: 4 additions & 1 deletion src/library/scala/collection/Seq.scala
Expand Up @@ -46,7 +46,10 @@ object Seq extends SeqFactory[Seq] {

private[collection] val hashSeed = "Seq".hashCode

implicit def builderFactory[A]: BuilderFactory[A, Seq[A], Coll] = new VirtualBuilderFactory[A]
implicit def canBuildFrom[A]: CanBuildFrom[Coll, A, Seq[A]] =
new GenericCanBuildFrom[A] {
def apply() = newBuilder[A]
}
def newBuilder[A]: Builder[A, Seq[A]] = immutable.Seq.newBuilder[A]

@deprecated("use View instead")
Expand Down
12 changes: 6 additions & 6 deletions src/library/scala/collection/SeqLike.scala
Expand Up @@ -390,7 +390,7 @@ trait SeqLike[+A, +Repr] extends IterableLike[A, Repr] { self =>
* @return a sequence containing the elements of this
* sequence and those of the given sequence <code>that</code>.
*/
def union[B >: A, That](that: Seq[B])(implicit bf: BuilderFactory[B, That, Repr]): That =
def union[B >: A, That](that: Seq[B])(implicit bf: CanBuildFrom[Repr, B, That]): That =
this ++ that

/** <p>
Expand Down Expand Up @@ -474,7 +474,7 @@ trait SeqLike[+A, +Repr] extends IterableLike[A, Repr] { self =>
* except that `replaced` elements starting from `from` are replaced
* by `patch`.
*/
def patch[B >: A, That](from: Int, patch: Seq[B], replaced: Int)(implicit bf: BuilderFactory[B, That, Repr]): That = {
def patch[B >: A, That](from: Int, patch: Seq[B], replaced: Int)(implicit bf: CanBuildFrom[Repr, B, That]): That = {
val b = bf(repr)
val (prefix, rest) = this.splitAt(from)
b ++= toCollection(prefix)
Expand All @@ -485,7 +485,7 @@ trait SeqLike[+A, +Repr] extends IterableLike[A, Repr] { self =>

/** Returns a copy of this sequence with the element at position `index` replaced by `elem`.
*/
def updated[B >: A, That](index: Int, elem: B)(implicit bf: BuilderFactory[B, That, Repr]): That = {
def updated[B >: A, That](index: Int, elem: B)(implicit bf: CanBuildFrom[Repr, B, That]): That = {
val b = bf(repr)
val (prefix, rest) = this.splitAt(index)
b ++= toCollection(prefix)
Expand All @@ -496,7 +496,7 @@ trait SeqLike[+A, +Repr] extends IterableLike[A, Repr] { self =>

/** Returns a new sequence consisting of `elem` followed by the elements of this sequence.
*/
def +:[B >: A, That](elem: B)(implicit bf: BuilderFactory[B, That, Repr]): That = {
def +:[B >: A, That](elem: B)(implicit bf: CanBuildFrom[Repr, B, That]): That = {
val b = bf(repr)
b += elem
b ++= thisCollection
Expand All @@ -505,7 +505,7 @@ trait SeqLike[+A, +Repr] extends IterableLike[A, Repr] { self =>

/** Returns a new sequence consisting of the elements of this sequence followed by `elem`.
*/
def :+[B >: A, That](elem: B)(implicit bf: BuilderFactory[B, That, Repr]): That = {
def :+[B >: A, That](elem: B)(implicit bf: CanBuildFrom[Repr, B, That]): That = {
val b = bf(repr)
b ++= thisCollection
b += elem
Expand All @@ -518,7 +518,7 @@ trait SeqLike[+A, +Repr] extends IterableLike[A, Repr] { self =>
/** Returns a new sequence of given length containing the elements of this sequence followed by zero
* or more occurrences of given elements.
*/
def padTo[B >: A, That](len: Int, elem: B)(implicit bf: BuilderFactory[B, That, Repr]): That = {
def padTo[B >: A, That](len: Int, elem: B)(implicit bf: CanBuildFrom[Repr, B, That]): That = {
val b = bf(repr)
b.sizeHint(length max len)
var diff = len - length
Expand Down
6 changes: 3 additions & 3 deletions src/library/scala/collection/SeqProxyLike.scala
Expand Up @@ -47,12 +47,12 @@ trait SeqProxyLike[+A, +This <: SeqLike[A, This] with Seq[A]] extends SeqLike[A,
override def endsWith[B](that: Seq[B]): Boolean = self.endsWith(that)
override def indexOfSeq[B >: A](that: Seq[B]): Int = self.indexOfSeq(that)
override def contains(elem: Any): Boolean = self.contains(elem)
override def union[B >: A, That](that: Seq[B])(implicit bf: BuilderFactory[B, That, This]): That = self.union(that)(bf)
override def union[B >: A, That](that: Seq[B])(implicit bf: CanBuildFrom[This, B, That]): That = self.union(that)(bf)
override def diff[B >: A, That](that: Seq[B]): This = self.diff(that)
override def intersect[B >: A, That](that: Seq[B]): This = self.intersect(that)
override def removeDuplicates: This = self.removeDuplicates
override def patch[B >: A, That](from: Int, patch: Seq[B], replaced: Int)(implicit bf: BuilderFactory[B, That, This]): That = self.patch(from, patch, replaced)(bf)
override def padTo[B >: A, That](len: Int, elem: B)(implicit bf: BuilderFactory[B, That, This]): That = self.padTo(len, elem)(bf)
override def patch[B >: A, That](from: Int, patch: Seq[B], replaced: Int)(implicit bf: CanBuildFrom[This, B, That]): That = self.patch(from, patch, replaced)(bf)
override def padTo[B >: A, That](len: Int, elem: B)(implicit bf: CanBuildFrom[This, B, That]): That = self.padTo(len, elem)(bf)
override def indices: Range = self.indices
override def view = self.view
override def view(from: Int, until: Int) = self.view(from, until)
Expand Down
6 changes: 5 additions & 1 deletion src/library/scala/collection/SeqView.scala
Expand Up @@ -23,6 +23,10 @@ trait SeqView[+A, +Coll] extends SeqViewLike[A, Coll, SeqView[A, Coll]]

object SeqView {
type Coll = TraversableView[_, C] forSome {type C <: Traversable[_]}
implicit def builderFactory[A]: BuilderFactory[A, SeqView[A, Seq[_]], Coll] = new BuilderFactory[A, SeqView[A, Seq[_]], Coll] { def apply(from: Coll) = new NoBuilder }
implicit def canBuildFrom[A]: CanBuildFrom[Coll, A, SeqView[A, Seq[_]]] =
new CanBuildFrom[Coll, A, SeqView[A, Seq[_]]] {
def apply(from: Coll) = new NoBuilder
def apply() = new NoBuilder
}
}

4 changes: 2 additions & 2 deletions src/library/scala/collection/SeqViewLike.scala
Expand Up @@ -154,7 +154,7 @@ trait SeqViewLike[+A,

override def reverse: This = newReversed.asInstanceOf[This]

override def patch[B >: A, That](from: Int, patch: Seq[B], replaced: Int)(implicit bf: BuilderFactory[B, That, This]): That = {
override def patch[B >: A, That](from: Int, patch: Seq[B], replaced: Int)(implicit bf: CanBuildFrom[This, B, That]): That = {
newPatched(from, patch, replaced).asInstanceOf[That]
// was: val b = bf(repr)
// if (b.isInstanceOf[NoBuilder[_]]) newPatched(from, patch, replaced).asInstanceOf[That]
Expand All @@ -163,7 +163,7 @@ trait SeqViewLike[+A,

//TR TODO: updated, +: ed :+ ed

override def padTo[B >: A, That](len: Int, elem: B)(implicit bf: BuilderFactory[B, That, This]): That =
override def padTo[B >: A, That](len: Int, elem: B)(implicit bf: CanBuildFrom[This, B, That]): That =
patch(length, fill(len - length)(elem), 0)

override def stringPrefix = "SeqView"
Expand Down
2 changes: 1 addition & 1 deletion src/library/scala/collection/Set.scala
Expand Up @@ -36,5 +36,5 @@ trait Set[A] extends (A => Boolean)
*/
object Set extends SetFactory[Set] {
override def empty[A]: Set[A] = immutable.Set.empty[A]
implicit def builderFactory[A]: BuilderFactory[A, Set[A], Coll] = setBuilderFactory[A]
implicit def canBuildFrom[A]: CanBuildFrom[Coll, A, Set[A]] = setCanBuildFrom[A]
}
2 changes: 1 addition & 1 deletion src/library/scala/collection/SortedMap.scala
Expand Up @@ -31,7 +31,7 @@ trait SortedMap[A, +B] extends Map[A, B] with SortedMapLike[A, B, SortedMap[A, B
* @since 2.8
*/
object SortedMap extends ImmutableSortedMapFactory[immutable.SortedMap] {
implicit def builderFactory[A, B](implicit ord: Ordering[A]): BuilderFactory[(A, B), SortedMap[A, B], Coll] = new SortedMapBuilderFactory[A, B]
implicit def canBuildFrom[A, B](implicit ord: Ordering[A]): CanBuildFrom[Coll, (A, B), SortedMap[A, B]] = new SortedMapCanBuildFrom[A, B]
def empty[A, B](implicit ord: Ordering[A]): immutable.SortedMap[A, B] = immutable.SortedMap.empty[A, B](ord)
}

Expand Down
2 changes: 1 addition & 1 deletion src/library/scala/collection/SortedSet.scala
Expand Up @@ -27,7 +27,7 @@ trait SortedSet[A] extends Set[A] with SortedSetLike[A, SortedSet[A]] {
* @since 2.8
*/
object SortedSet extends ImmutableSortedSetFactory[immutable.SortedSet] {
implicit def builderFactory[A](implicit ord: Ordering[A]): BuilderFactory[A, SortedSet[A], Coll] = new SortedSetBuilderFactory[A]
implicit def canBuildFrom[A](implicit ord: Ordering[A]): CanBuildFrom[Coll, A, SortedSet[A]] = new SortedSetCanBuildFrom[A]
def empty[A](implicit ord: Ordering[A]): immutable.SortedSet[A] = immutable.SortedSet.empty[A](ord)
}

Expand Down

0 comments on commit f818b44

Please sign in to comment.