Last active
August 29, 2015 14:05
-
-
Save alexarchambault/2c96317f0654784ba0ee to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trait StableColl[CC[Elem]] { | |
def builder[Elem](): mutable.Builder[Elem, CC[Elem]] | |
} | |
object StableColl { | |
def apply[CC[Elem]](implicit stableColl: StableColl[CC]): StableColl[CC] = stableColl | |
implicit def stableCollSeq: StableColl[Seq] = | |
new StableColl[Seq] { | |
def builder[Elem]() = new mutable.ListBuffer[Elem] | |
} | |
implicit def stableCollList: StableColl[List] = | |
new StableColl[List] { | |
def builder[Elem]() = new mutable.ListBuffer[Elem] | |
} | |
implicit def stableCollIndexedSeq: StableColl[IndexedSeq] = | |
new StableColl[IndexedSeq] { | |
def builder[Elem]() = new mutable.ArrayBuffer[Elem] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment