Ray Rahke
03/03/2024, 7:24 PMAdam S
03/03/2024, 7:30 PMin
is the representation for the contains(...)
operator function https://kotlinlang.org/docs/operator-overloading.html#in-operator
So in IntelliJ you can always use m.contains(...)
to see the auto complete suggestions, and there's none for checking if a Pair exists in a map.
@Deprecated("Bugged! See thread below")
operator fun <K, V> Map<K, V>.contains(keyValue: Pair<K, V>): Boolean =
containsKey(keyValue.first) && containsValue(keyValue.second)
ephemient
03/03/2024, 7:31 PMm["foo"] == 1
like a normal Map usageRay Rahke
03/03/2024, 7:32 PMRay Rahke
03/03/2024, 7:32 PMephemient
03/03/2024, 7:32 PMephemient
03/03/2024, 7:32 PMRay Rahke
03/03/2024, 7:32 PMRay Rahke
03/03/2024, 7:33 PMephemient
03/03/2024, 7:33 PMRay Rahke
03/03/2024, 7:33 PMRay Rahke
03/03/2024, 7:33 PMephemient
03/03/2024, 7:33 PMRay Rahke
03/03/2024, 7:34 PMephemient
03/03/2024, 7:34 PMRay Rahke
03/03/2024, 7:34 PMephemient
03/03/2024, 7:34 PMephemient
03/03/2024, 7:34 PMAdam S
03/03/2024, 7:34 PMcontainsKey+containsValue doesn't mean it's in the same mapping…d'oh, true!
Ray Rahke
03/03/2024, 7:34 PMephemient
03/03/2024, 7:34 PMnull == 1
is falseRay Rahke
03/03/2024, 7:34 PMephemient
03/03/2024, 7:35 PMRay Rahke
03/03/2024, 7:35 PMRay Rahke
03/03/2024, 7:35 PMin
keyword yeah?Ray Rahke
03/03/2024, 7:35 PMephemient
03/03/2024, 7:35 PMAdam S
03/03/2024, 7:36 PMval m = listOf("foo" to 1, "bar" to 2)