当前位置:网站首页>Scala template method pattern
Scala template method pattern
2022-06-25 01:03:00 【Jue Niu thunder plough hot blade】
object Template method pattern {
abstract class Template {
// Used to execute indeterminate code
def code()
def getRuntime(): Long = {
val start = System.currentTimeMillis()
code()
val end = System.currentTimeMillis()
end - start
}
}
class ForDemo extends Template {
override def code(): Unit = for (i <- 1 to 10000) println(s"Hello, Scala:${i}")
}
def main(args: Array[String]): Unit = {
val fr = new ForDemo
val time = fr.getRuntime()
println(time)
}
}
边栏推荐
- 传输层 以字节为单位的滑动窗口技术
- Garbage collection of C closure
- Network request -volley
- Can communication experiment between C and C
- 移动安全工具-apktool
- [redis realizes seckill service ②] solution to oversold problem
- [micro service sentinel] real time monitoring | RT | throughput | concurrency | QPS
- 百公里加速仅5.92秒,威兰达高性能版以高能产品实力领跑
- 2022熔化焊接与热切割复训题库模拟考试平台操作
- JSON file of China's provincial boundaries
猜你喜欢

108页(4万字)未来公寓智能化设计平台项目方案建议书2022版

JMeter socket connection sends data

2022熔化焊接与热切割复训题库模拟考试平台操作

How to quickly open traffic master for wechat applet

Activity startup process

QT(35)-操作EXCEL-QXlsx-QAxObject

Working principle analysis of kubernetes architecture core components

Sliding window technology based on byte in transport layer

【微服务|Sentinel】簇点链路|微服务集群环境搭建

Xcode预览(Preview)显示List视图内容的一个Bug及解决
随机推荐
Hot fix sophix multi-channel patch solution
Databinding quick start (still using findviewbyid?)
热力图展示相关矩阵
实现mnist手写数字识别
Mobile security tool apktool
百公里加速仅5.92秒,威兰达高性能版以高能产品实力领跑
2021-11-07
Add information on the left and add parts on the right of the status bar
The basic principle and application of iterator and enhanced for
打卡smart精灵#1,品牌不缺吸引力,产品本身实力如何?
A plug-in framework for implementing registration free and login verification with hook technology
不重要的token可以提前停止计算!英伟达提出自适应token的高效视觉Transformer网络A-ViT,提高模型的吞吐量!...
Use coordinatorlayout+appbarlayout+collapsingtoolbarlayout to create a collapsed status bar
Golang示例续期锁:Redis+Channel+sync.Mutex
redis + lua实现分布式接口限流实现方案
If the order has not been paid for 30 minutes, it will be automatically cancelled. How can I achieve this?
QT (35) - operate excel qxlsx qaxobject
【微服务|Sentinel】簇点链路|微服务集群环境搭建
Use of navigation and navigationui
Virtual machine - network configuration