+操作符的重载案例:
case class TurnupMetric(turnup_num: Long,
turnup_users: Set[String],
vv: Long,
fuv: Set[String],
realvv: Long,
realfuv: Set[String],
playtime: Long
) extends Serializable {
def +(other: TurnupMetric): TurnupMetric = {
TurnupMetric(
turnup_num + other.turnup_num,
turnup_users ++ other.turnup_users,
vv + other.vv,
fuv ++ other.fuv,
realvv + other.realvv,
realfuv ++ other.realfuv,
playtime + other.playtime
)
}
}
Scala操作符的重载
最新推荐文章于 2021-04-16 15:39:05 发布