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
package x | |
object X | |
{ | |
def main(arr:Array[String]): Unit = { | |
System.err.println(s"build with ${BuildInfo.millis}"); | |
} | |
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 Log | |
{ | |
def apply(msg: String): Unit = macro applyImpl | |
def applyImpl(c: Context)(msg: c.Expr[String]):c.Expr[Unit] = | |
{ | |
import c.universe._ | |
val tree = q"""if (Log.enabled) { |
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
Do { | |
x += 1 | |
} until ( x != 10 ) |
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 Do | |
{ | |
def apply(body: => Unit) = new DoDody(body) | |
} | |
class DoBody(body: => Unit) | |
{ | |
def until(cond: =>Unit): Unit = | |
{ body | |
while(!cond) |
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
p match { | |
case Person(“Jon”,”Galt” ) => “Hi, who are you ?” | |
case Person(firstName, lastName) => s”Hi, ${firstName}, ${lastName}” | |
case _ => “You are not person” | |
} |
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
trait AsyncInputOutput[T] | |
{ | |
def onReceive(f: T => Unit): Unit | |
def onSend(f: Unit => T): Unit | |
} |
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
interface AsyncInputOutput<T> | |
{ | |
void onReceive(Acceptor<T> acceptor) | |
void onSend(Generator<T> generator) | |
} |
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
peoples.filter(_.firstName == “Jon”) |
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
peoples.stream().filter( x -> x.firstName.equals(”Jon”)).collect(Collectors.toList()) |
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
trait MyToString | |
{ | |
override def toString = s”[${super.toString}]” | |
} |