Answer the question
In order to leave comments, you need to log in
How to correctly specify variables in Kotlin?
Good day. I use Kotlin and Spring. Tell me how to work with variables (in the structure below) in order to avoid constant checking for NULL and writing "!!"?
There are such variables in the class
@Autowired
var newsModules: NewsModules
@Autowired
var usersModules: UsersModules
@Autowired
var regionsModules: RegionsModules
@Autowired
var productModule: ProductsModules
@Autowired
var requestsModules: RequestsModules
init {
newsModules = NewsModules()
usersModules = UsersModules()
regionsModules = RegionsModules()
productModule = ProductsModules()
requestsModules = RequestsModules()
}
@Autowired
var newsModules: NewsModules? = null
...
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question