package com.spark.scala.basics
/**
* 1.
*/
case class Person1(name: String, age: Int)
class Coder(val name:String, val salary: Int)
object Coder {
def apply(name:String, salary: Int): Unit = {
println("Coder apply method invoked!!")
new Coder(name, salary)
}
def unapply(information: String) = { //提取,用Some封装成Tuple
Some((information.substring(0, information.indexOf(" ")), inform
Scala基础—提取器Extractor使用示例
最新推荐文章于 2024-03-27 19:54:51 发布