aoriani
12/31/2019, 12:36 AMcsturtevant
12/31/2019, 5:29 AMresponse is a
org.springframework.http.ResponseEntity<List<Task>>
with Task being a regular POJO. val tasks = response.body ?: arrayListOf<Task>() does look better but if you have any other suggestions based on the new evidence I’d be highly appreciative!aoriani
12/31/2019, 9:00 AM@Nullable so Kotlin can at least say it returns a nullable type. Thus coercing to a non-null could be a problem.
Now the best code actually depends of the context. I am not familiar with Spring.aoriani
12/31/2019, 9:07 AMgetBody()
is nullable because ResponseEntity represents any HTTP response and not all responses have a body. An HTTP 204, for instance, doesn't have a body.aoriani
12/31/2019, 9:18 AM