We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
!!
For example in Properties/Lazy property/src/Task.kt the solution:
Properties/Lazy property/src/Task.kt
class LazyProperty(val initializer: () -> Int) { var value: Int? = null val lazy: Int get() { if (value == null) { value = initializer() } return value!! } }
Would be safer using:
class LazyProperty(val initializer: () -> Int) { private var value: Int? = null val lazy: Int get() = value ?: initializer().also { value = it } }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
For example in
Properties/Lazy property/src/Task.kt
the solution:Would be safer using:
The text was updated successfully, but these errors were encountered: