The second judgment, adding synchronized key frame to ensure thread safety.If already initialized, it returns the same level 1 judgment as in Java.This is the value of the singleton delegate analyzed above._value Disables instruction reordering with volatile.The above code has been commented in place Private fun writeReplace(): Any = InitializedLazyImpl(value) ![]() object HungryS in override fun isInitialized(): Boolean = _value ! = UNINITIALIZED_VALUE override fun toString(): String = if (isInitialized()) value.toString() else "Lazy value not initialized yet." Instead of using Java's private Constroctor and getInstance interfaces, you can use Object directly.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |