Skip to content

Instantly share code, notes, and snippets.

@jaspersprengers jaspersprengers/bitcointodollar.kt Secret

Last active Feb 4, 2018
Embed
What would you like to do?
Two ways to define a functional interface implementation
class BitCoinToDollarConverter : (Double) -> Double {
override fun invoke(bitcoins: Double) = bitcoins * 10000 * Random().nextDouble()
}
//version with operator
class BitCoinToDollarConverter {
operator fun invoke(bitcoins: Double) =
bitcoins * 10000 * Random().nextDouble()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.