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
class Test { | |
val isEvn = (x: Int) => x % 2 == 0 | |
def isEven(x: Int) = x % 2 == 0 | |
} |
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 Friend{ | |
val name: String | |
def listen = println(s"i am $name, listening...") | |
} | |
class Human(val name: String) extends Friend | |
class Animal | |
class Dog(val name: String) extends Animal with Friend |
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 Animal{ | |
def speak: Unit | |
def walk: Unit | |
def comeToMaster: Unit | |
} | |
abstract class AnimalClass extends Animal{ | |
def speak = println("speaking..") | |
def walk = println("walking fastly..") | |
} |
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 Animal{ | |
def speak = println("speaking..") | |
def walk = println("walking fastly..") | |
def comeToMaster: Unit | |
} | |
class Cat extends Animal{ | |
override def speak: Unit = println("meow....") | |
def comeToMaster = println("catch me if you can..") | |
} |
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 trait State | |
case object Waiting extends State | |
case object Active extends State | |
case class Msg(a: Int) | |
case object Flush | |
case class StateData(queue: immutable.Queue[Msg]) | |
class SizeBasedThrottler extends FSM[State, StateData] { |
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 trait State | |
case object Waiting extends State | |
case object Active extends State | |
case class Msg(a: Int) | |
case object Flush | |
case class StateData(queue: immutable.Queue[Msg]) | |
class SizeBasedThrottler extends FSM[State, StateData] { |