fun <T> test(block: (T) -> Unit) {
}
fun <T> test(block: T.() -> Unit) {
}
I'm studying libraries like apply()
and also()
in Cotlin But I don't understand T.()
here.
The first one makes sense. T
is received as a parameter and used within the lambda block, right?
That is, what can be used as it
.
But I don't really understand the second one.
I don't know what T.()
means. I don't really understand what it's delivering as a factor.
If it's a Lambda-style parameter, it should be (T)() -> Unit
but this makes an error.
block: Int() -> Unit
I tried it like this, but I don't know what it means.
It would be helpful if you refer to it ... https://kotlinlang.org/docs/extensions.html
......
618 Uncaught (inpromise) Error on Electron: An object could not be cloned
574 Who developed the "avformat-59.dll" that comes with FFmpeg?
578 Understanding How to Configure Google API Key
573 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
916 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
© 2024 OneMinuteCode. All rights reserved.