This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@ExperimentalContracts | |
fun User?.isComplete(): Boolean { | |
contract { returns(true) implies (this@isComplete != null) } | |
return this != null && this.isValid() | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
contract { | |
returns(true) implies (this@isComplete != null) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun main(args: Array<String>) { | |
var assign: String | |
val time = measureTimeMillis { | |
assign = "Value Assigned" | |
} | |
println("$time ms. spent assigning: '$assign!!'") | |
} | |
private inline fun measureTimeMillis(block: () -> Unit): Long { | |
val start = System.currentTimeMillis() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@ExperimentalContracts | |
fun main(args: Array<String>) { | |
var assign: String | |
val time = measureTimeMillis { | |
assign = "Value Assigned" | |
} | |
println("$time ms. spent assigning: '$assign'") | |
} | |
@ExperimentalContracts |
OlderNewer