Skip to content

Instantly share code, notes, and snippets.

@jkschneider
Created December 26, 2015 16:07
Show Gist options
  • Save jkschneider/44fdc00849647c093944 to your computer and use it in GitHub Desktop.
Save jkschneider/44fdc00849647c093944 to your computer and use it in GitHub Desktop.
@Test fun toSortedMap_comparator() {
val expected = mapOf("c" to 6, "a" to 4, "b" to 2, "d" to 0)
val actual = original.toSortedMap(comparator { x, y -> (original[y] as Int).compareTo((original[x] as Int)) })
assertOrder(expected, actual)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment