Skip to content

Instantly share code, notes, and snippets.

@DenisBronx
Last active April 15, 2020 22:08
Show Gist options
  • Save DenisBronx/98eedd681768ed532ae55fe7eeae4bfe to your computer and use it in GitHub Desktop.
Save DenisBronx/98eedd681768ed532ae55fe7eeae4bfe to your computer and use it in GitHub Desktop.
Repository Pattern NullableInputListMapper
// Nullable to Non-nullable
interface NullableInputListMapper<I, O>: Mapper<List<I>?, List<O>>
class NullableInputListMapperImpl<I, O>(
private val mapper: Mapper<I, O>
) : NullableInputListMapper<I, O> {
override fun map(input: List<I>?): List<O> {
return input?.map { mapper.map(it) }.orEmpty()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment