object Name{ def unapply(str:String)={ val pos = str.indexOf(" ") if(pos == -1)None else Some(str.substring(0,pos),str.substring(pos+1)) }}
样板类具有apply和unpply方法
scala apply unpdate unpply
原文:https://www.cnblogs.com/liqingan/p/10192219.html