Brad M
04/30/2021, 8:43 PMisEmpty
method that is functionally equivalent in our case to null? For example:
val files: Map<UUID, MultipartFile>;
val fileUrls = if (files?.isNotEmpty()) {
uploadFiles(files).bind() // returns Either<MyError, Map<UUID, Url>>
} else null
Cody Mikol
05/05/2021, 11:52 PM(files?.isNotEmpty() ?: false)
, but I also think you might want to reconsider using null here. Why not just have uploadFiles(files).bind()
return an empty map? or even do validation and return MyError.left()
if this constitutes an error.Brad M
05/05/2021, 11:53 PMBrad M
05/05/2021, 11:55 PMBrad M
05/05/2021, 11:56 PM