Last active
June 4, 2017 23:27
-
-
Save keyurgolani/f10330956b5d907dcb0d5ea5e446fd08 to your computer and use it in GitHub Desktop.
Kotlin Utility Functions Added to Builtin Classes for convenience.
This file contains hidden or 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 List<Int>.isEqualTo(other: List<Int>): Boolean { | |
if (this.size != other.size) { | |
return false | |
} | |
return (0..this.size - 1).all { this[it].equals(other[it]) } | |
} | |
fun List<Int>.isNotEqualTo(other: List<Int>): Boolean { | |
if (this.size != other.size) { | |
return true | |
} | |
return (0..this.size - 1).any { !this[it].equals(other[it]) } | |
} | |
fun Int.toBigInteger(): BigInteger { | |
return BigInteger.valueOf(this.toLong()) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment