我的问题是这两者之间有什么区别
@Volatile private var INSTANCE: SomeClass? = null
fun getInstance(someValue: SomeType): SomeClass{
return INSTANCE ?: synchronized(this) {
INSTANCE ?: SomeClass(someValue).also { INSTANCE = it }
}
}
和
object SomeClass {
....
}