首页
Python
Java
IOS
Andorid
NodeJS
JavaScript
HTML5
【
learning scala akka tell pattern(二)
】的更多相关文章
learning scala akka tell pattern(二)
package com.example import akka.actor._ object Tutorial_02_Tell_Pattern extends App { println("Step 1: Create an actory system") val system = ActorSystem("DonutStoreActorSystem") val donutInActor = system.actorOf(Props[DonutInActor], n…
learning scala akka ask_pattern
package com.example import akka.actor._ import akka.util.Timeout object Tutorial_03_Ask_Pattern extends App { val system = ActorSystem("DonutStoreActorySystem") val donutInfoActor = system.actorOf(Props[DonutInfoActor], name="DonutInfoActor…
learning scala akka actorySystem create and close
package com.example import akka.actor.ActorSystem import scala.util.{Failure, Success} import scala.concurrent.ExecutionContext.Implicits.global object Tutorial_01_ActorSystem_Introduction extends App { println("Step1 : Create an actor system")…
learning scala pattern matching 03
code: package com.aura.scala.day01 object patternMatching03 { //当不同类型对象需要调用不同方法时,仅匹配类型的模式非常有用. def goIDLE(device : Device) = device match { case p: Phone => p.screenOff case c:Computer => c.screenSaverOn } } abstract class Device case class Phone(mo…
learning scala pattern matching 02
code package com.aura.scala.day01 object patternMatching02 { def main(args: Array[String]): Unit = { def showNotifacation(notification: Notification):String = { notification match { case Email(sender, title, _) => s"You got an email from $sender w…
learning scala pattern matching
code: package com.aura.scala.day01 import scala.util.Random object patternMatching01 { def main(args: Array[String]): Unit = { val x:Int = Random.nextInt() // 一个模式匹配语句包括一个待匹配的值,match关键字,以及至少一个case 语句. x match { => "zero" => "one"…
【原创】大叔经验分享(73)scala akka actor
import java.util.concurrent.{ExecutorService, Executors, TimeUnit} import akka.actor.{Actor, ActorSystem, Props} import akka.util.Timeout import scala.concurrent.{Await, ExecutionContext} import scala.concurrent.duration.Duration Runnable 无返回值 class…
Scala学习笔记之二--基本数据类型
前言 本篇主要讲Scala的基本数据类型,更多教程请参考:Scala教程 基本数据类型 Scala一共提供了9中数据类型,Scala的基本数据类型与java中的基本数据类型是一一对应的,这是Scala的数据类型全是类,并且头字母大写 整数类型变量定义: //16进制 scala> val x = 0x29 x:Int = 41 //10进制 scala> val x = 41 x:Int = 41 //8进制 scala>051 res0:Int = 41 浮点型变量定义: //Doub…
Scala学习教程笔记二之函数式编程、Object对象、伴生对象、继承、Trait、
1:Scala之函数式编程学习笔记: :Scala函数式编程学习: 1.1:Scala定义一个简单的类,包含field以及方法,创建类的对象,并且调用其方法: class User { private var name = "张三"; def hello(): Unit ={ println("hello : " + name) } //注:如果定义方法时不带括号,则调用的时候也不可以加括号,否则报错. def getName = name; } //创建一个obj…
learning scala 数组和容器
数组:可变的,可索引的,元素具有相同类型的数据集合 一维数组 scala> val intValueArr = new Array[Int](3)intValueArr: Array[Int] = Array(0, 0, 0) scala> val myStrArr = Array("BigData","hadoop","spark")myStrArr: Array[String] = Array(BigData, hadoop, s…