//参考https://developer.android.com/codelabs/android-room-with-a-view-kotlin#7
//允许传入参数的DCL
class Singleton private constructor(a:Int) {
companion object {
@Volatile
private var INSTANCE:Singleton? = null
fun get(a:Int):Singleton{
return INSTANCE?: synchronized(this){
val instance = Singleton(a)
INSTANCE = instance
instance
}
}
}
}