Anthony Flores
03/01/2022, 4:49 PMSam
03/01/2022, 4:53 PMval lazy: Lazy<String> = lazy { "foo" }
val isInitialized = lazy.isInitialized()
Anthony Flores
03/01/2022, 4:53 PMSam
03/01/2022, 4:54 PMSam
03/01/2022, 4:54 PMval lazy: String by lazy { "foo" }
val isInitialized = lazy.isInitialized() // doesn't work
Anthony Flores
03/01/2022, 4:54 PMSam
03/01/2022, 4:55 PMval lazyFoo: Lazy<String> = lazy { "foo" }
val foo by lazyFoo
val fooIsInitialized = lazyFoo.isInitialized()
Joffrey
03/01/2022, 4:58 PMlazy
is saving you fromSam
03/01/2022, 4:59 PMval foo: String by lazy { "foo" }
val isInitalized = (::foo.getDelegate() as Lazy<*>).isInitialized()
but I wouldn't recommend it (and it doesn't help with the concurrency issue)Anthony Flores
03/01/2022, 5:40 PMJoffrey
03/01/2022, 5:44 PMAnthony Flores
03/01/2022, 6:00 PMAnthony Flores
03/01/2022, 6:00 PMYoussef Shoaib [MOD]
03/01/2022, 6:01 PMlateinit var
instead? because with that you may do object::propertyName.isInitialized
and under the hood it doesn't actually use reflectionJoffrey
03/01/2022, 6:11 PM5 separate ArrayLists per component for each and every "listener"Not sure I understand the cardinality here. Is that: • 5 arraylists per component per listener? In that case what is the 5 here? • 1 arraylist per component per listener, and there are 5 listeners per component? In any case, what are the elements of those lists? And are those lists
lazy
properties themselves or are the lists regular properties but containing lazy items?Joffrey
03/01/2022, 6:12 PMlazy
, but not the need for knowing that the lazy is initialized. This is mostly what I'm interested in (in case it's an XY problem)Anthony Flores
03/01/2022, 6:14 PMval mousePressedListener = ArrayList<UIComponent.() - Unit>()
Anthony Flores
03/01/2022, 6:53 PM