一、单例模式
class Singleton private constructor(){
companion object {
@JvmStatic
fun getInstance(): Singleton {
return SingletonHolder.instance
}
private object SingletonHolder {
var instance: Singleton = Singleton()
}
}
}
[未完成,后续补充]
网友评论