stdlib: stream() for Map #KT-6547 Fixed

This commit is contained in:
Ilya Ryzhenkov
2015-01-23 16:17:42 +03:00
parent 8873be22d5
commit bfeb21afb0
3 changed files with 18 additions and 0 deletions
@@ -119,6 +119,17 @@ public fun <T> Iterable<T>.stream(): Stream<T> {
}
}
/**
* Returns a stream from the given collection
*/
public fun <K, V> Map<K, V>.stream(): Stream<Map.Entry<K, V>> {
return object : Stream<Map.Entry<K, V>> {
override fun iterator(): Iterator<Map.Entry<K, V>> {
return this@stream.iterator()
}
}
}
/**
* Returns a stream from the given collection
*/