Last active
September 9, 2017 17:57
-
-
Save knightpop/807048e9a200a142587a4809b2d4db2a to your computer and use it in GitHub Desktop.
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
val userId: Long = 12 | |
val deviceUuid: Long = 1234 | |
val carSerialId: Long = 12345 | |
def getHashCode( | |
userId: Long, | |
deviceUuid: Long, | |
carSerialId: Long | |
): String = { | |
val userIdPlus: Long = userId + 1 | |
val deviceUuidPlus: Long = deviceUuid + 2 | |
val carSerialIdPlus: Long = carSerialId + 3 | |
s"$userIdPlus-$deviceUuidPlus-$carSerialIdPlus" | |
} | |
getHashCode(userId, deviceUuid, carSerialId) // Right Answer = res0: String = 13-1236-12348 | |
getHashCode(deviceUuid, userId, carSerialId) // Wrong Answer = res1: String = 1235-14-12348 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment