Breaking change. Map operations revisited.

This commit is contained in:
Ilya Ryzhenkov
2014-06-09 23:27:42 +04:00
parent 4167359c08
commit ce5f7e9d61
6 changed files with 140 additions and 108 deletions
@@ -205,21 +205,6 @@ fun filtering(): List<GenericFunction> {
return FilteringStream(this, true, predicate)
"""
}
include(Maps)
doc(Maps) { "Returns a map containing all key-value pairs matching the given *predicate*" }
returns(Maps) { "Map<K, V>" }
body(Maps) {
"""
val result = HashMap<K,V>()
for (entry in this) {
if (predicate(entry)) {
result.put(entry.key, entry.value)
}
}
return result
"""
}
}
templates add f("filterTo(destination: C, predicate: (T) -> Boolean)") {
@@ -246,8 +231,6 @@ fun filtering(): List<GenericFunction> {
return destination
"""
}
include(Maps)
}
templates add f("filterNot(predicate: (T) -> Boolean)") {
@@ -276,7 +259,6 @@ fun filtering(): List<GenericFunction> {
return FilteringStream(this, false, predicate)
"""
}
include(Maps)
}
templates add f("filterNotTo(destination: C, predicate: (T) -> Boolean)") {
@@ -300,7 +282,6 @@ fun filtering(): List<GenericFunction> {
return destination
"""
}
include(Maps)
}
templates add f("filterNotNull()") {