From 2855741572d309ed5f694590f00de27eec4a2d35 Mon Sep 17 00:00:00 2001 From: Ilya Ryzhenkov Date: Tue, 10 Jun 2014 00:20:54 +0400 Subject: [PATCH] Map.Entry.toPair --- libraries/stdlib/src/kotlin/collections/Maps.kt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libraries/stdlib/src/kotlin/collections/Maps.kt b/libraries/stdlib/src/kotlin/collections/Maps.kt index 0f21a570f35..57dcfc176dd 100644 --- a/libraries/stdlib/src/kotlin/collections/Maps.kt +++ b/libraries/stdlib/src/kotlin/collections/Maps.kt @@ -40,6 +40,11 @@ fun Map.Entry.component2(): V { return getValue() } +/** Converts entry to Pair with key being first component and value being second */ +fun Map.Entry.toPair(): Pair { + return Pair(getKey(), getValue()) +} + /** * Returns the value for the given key or returns the result of the defaultValue function if there was no entry for the given key *