split the filter method into filter(predicate) and filterTo(result, predicate) for easier completion & avoid confusion - seems 2 methods is better than the default arguments approach

This commit is contained in:
James Strachan
2012-02-29 09:51:38 +00:00
parent 27ece9c765
commit 7f4bc1a121
+2 -2
View File
@@ -67,7 +67,7 @@ class CollectionTest() : TestSupport() {
fun testFilterIntoLinkedList() { fun testFilterIntoLinkedList() {
// TODO would be nice to avoid the <String> // TODO would be nice to avoid the <String>
val foo = data.filter(linkedList<String>()){it.startsWith("f")} val foo = data.filterTo(linkedList<String>()){it.startsWith("f")}
assertTrue { assertTrue {
foo.all{it.startsWith("f")} foo.all{it.startsWith("f")}
@@ -82,7 +82,7 @@ class CollectionTest() : TestSupport() {
fun testFilterIntoSortedSet() { fun testFilterIntoSortedSet() {
// TODO would be nice to avoid the <String> // TODO would be nice to avoid the <String>
val foo = data.filter(hashSet<String>()){it.startsWith("f")} val foo = data.filterTo(hashSet<String>()){it.startsWith("f")}
assertTrue { assertTrue {
foo.all{it.startsWith("f")} foo.all{it.startsWith("f")}