Skip to content

Instantly share code, notes, and snippets.

@knightpop
Last active September 9, 2017 17:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save knightpop/807048e9a200a142587a4809b2d4db2a to your computer and use it in GitHub Desktop.
Save knightpop/807048e9a200a142587a4809b2d4db2a to your computer and use it in GitHub Desktop.
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