Skip to content

Instantly share code, notes, and snippets.

@s1monw1
Last active March 17, 2023 13:26
Show Gist options
  • Save s1monw1/86c9abe05032346f245a6ee2b6637fab to your computer and use it in GitHub Desktop.
Save s1monw1/86c9abe05032346f245a6ee2b6637fab to your computer and use it in GitHub Desktop.
class PrintingCustomizer { // PrintingCustomizer is a dispatch receiver
private val separator = "________________"
fun <K, V> Map<K, V>.customPrint() { // Map<T, V> is an extension receiver for customPrint
forEach { (k, v) ->
println("K: $k")
println("V: $v")
println(separator)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment