Created
June 19, 2015 15:33
-
-
Save mctigger/b5c1408c8e5cea48f044 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
object BugFixProject { | |
def main (args: Array[String]) { | |
val repoWithEntities = Seq( | |
(ARepo, Seq(A("", ""), A("", ""))), | |
(BRepo, Seq(B("", ""), B("", ""))) | |
) | |
printall(repoWithEntities) | |
} | |
def printall[Entity](pairs: Seq[(BaseRepo[Entity], Seq[Entity])]) : Seq[String] = { | |
pairs.map { t => | |
val repo = t._1 | |
val entities = t._2 | |
entities.map(repo.toString(_)) | |
}.flatten | |
} | |
} | |
case class A(foo: String, bar: String){} | |
case class B(foo: String, bar: String){} | |
trait BaseRepo[X] { | |
def toString(x: X) : String = x.toString | |
} | |
object BRepo extends BaseRepo[B] {} | |
object ARepo extends BaseRepo[A] {} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment