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
\u006f\u0062\u006a\u0065\u0063\u0074\u0020 | |
\u0057\u0065\u006c\u006c\u006f\u0048\u006f\u0072\u006c\u0064\u0020 | |
\u0065\u0078\u0074\u0065\u006e\u0064\u0073\u0020 | |
\u0041\u0070\u0070\u0020\u007b\u000a\u0020 | |
\u0020\u0070\u0072\u0069\u006e\u0074\u006c\u006e\u0028 | |
\u0022\u0057\u0065\u006c\u006c\u006f\u0048\u006f\u0072\u006c\u0064\u0022 | |
\u0029\u000a\u007d\u000a |
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
object ExistentialsConsideredHarmful { | |
class Animal(val name: String) | |
object Dog extends Animal("Dog") | |
object Sheep extends Animal("Sheep") | |
trait Tools[A] { | |
def shave(a: A): A | |
} | |
def tools[A](a: A): Tools[A] = null // dummy | |
case class TransportBox[A <: Animal](animal: A, tools: Tools[A]) { |
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
sealed abstract class Bound[+T] { val value : T } | |
case class Closed[T : Ordering](value : T) extends Bound[T] | |
case class Opened[T : Ordering](value : T) extends Bound[T] | |
object Bound { | |
implicit def ordering[T: Ordering]: Ordering[Bound[T]] = Ordering.by((_: Bound[T]).value) | |
} | |
object BoundDemo { | |
def main(args : Array[String]) : Unit = { |
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 Holder { | |
def x: String | |
def y: Int | |
def getX = { | |
println("While initializing x") | |
Thread.sleep(5000); | |
println("Finished initializing x") | |
null | |
} |
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
abstract class Action | |
case object Eat extends Action | |
case object Speak extends Action | |
case object Move extends Action | |
abstract class Creature (val action: Action) | |
case class Fish (a: Action, val size: String) extends Creature (a) | |
case class Dog (a: Action, val sound: String) extends Creature (a) |
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
package cc.spray.examples.calculator | |
import akka.config.Supervision._ | |
import akka.actor.Supervisor | |
import akka.actor.Actor._ | |
import cc.spray._ | |
import utils.ActorHelpers._ | |
class Boot { | |
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
D/dalvikvm(14165): DexOptY: --- BEGIN 'classes.jar' (bootstrap=0) --- | |
D/dalvikvm(14166): creating instr width table | |
D/dalvikvm(14166): --- LinearAllocV(interfaces, 0x0, 16) | |
D/dalvikvm(14166): --- LinearAllocV(ifields, 0x0, 60) | |
D/dalvikvm(14166): --- LinearAllocV(directMethods, 0x0, 1092) | |
D/dalvikvm(14166): --- LinearAllocV(virtualMethods, 0x0, 3016) | |
D/dalvikvm(14166): CLASS: linking 'Ljava/lang/Class;'... | |
D/dalvikvm(14166): --- LinearAllocV(directMethods, 0x0, 104) | |
D/dalvikvm(14166): --- LinearAllocV(virtualMethods, 0x0, 572) | |
D/dalvikvm(14166): CLASS: linking 'Ljava/lang/Object;'... |
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 X[T] { | |
type Next[U] <: X[U] | |
def add[U](gen: U): Next[(T, U)] | |
} | |
object Tester { | |
val x: X[Int] = null | |
val y = | |
x.add(1) |
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
scala> import collection.JavaConversions._ | |
import collection.JavaConversions._ | |
scala> def allIf(clazz: Class[_]): Seq[String] = clazz.getInterfaces.map(_.toString) ++ clazz.getInterfaces.flatMap(allIf) | |
allIf: (clazz: Class[_])Seq[String] | |
scala> val theClazz = Class.forName("scala.collection.immutable.StreamViewLike$$anon$10") | |
theClazz: Class[_] = class scala.collection.immutable.StreamViewLike$$anon$10 | |
scala> val res0 = { allIf(theClazz) } |
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
/bin | |
/gen |