I have this String array:
var parsedWeatherData: Array<String>?
And I want to add some weather data from JSON file using this code:
val weatherArray = forecastJson.getJSONArray(OWM_LIST)
parsedWeatherData = arrayOfNulls<String>(weatherArray.length())
The error is that the parsedWeatherData requires Array<String>? and not Array<String?>. How can I change the value from arrayOfNulls() to be of type Array<String>??
filterNotNullmaybe will work for you?