Created
November 14, 2015 03:52
-
-
Save anishpatel/2dcd54f96781567c5248 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
import scala.collection.immutable.List; | |
abstract class ForkJoin { | |
protected def getList[T]: List[T] | |
def apply[A, B]: (List[A], List[B]) = { | |
(getList[A], getList[B]) | |
} | |
} | |
object ForkJoin { | |
def main(args: Array[String]) = { | |
val forkJoin = new ForkJoin { | |
override protected def getList[T]: scala.List[T] = | |
List.empty[T] | |
} | |
val (intList, stringList) = forkJoin[Int, String] | |
println(3 :: intList) | |
println("Hello" :: stringList) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment