KT-3823 Standard sort function requires MutableIterable by no reason

#KT-3823 Fixed
This commit is contained in:
Nikolay Krasko
2013-07-30 01:18:05 +04:00
parent b205e10b31
commit 2520f11bdc
2 changed files with 13 additions and 1 deletions
+12
View File
@@ -402,6 +402,18 @@ class CollectionTest {
// assertFalse(IterableWrapper(linkedList<Int>()).contains(15))
}
test fun sortForMutableIterable() {
val list : MutableIterable<Int> = arrayList<Int>(2, 3, 1)
expect(arrayList(1, 2, 3)) { list.sort() }
expect(arrayList(2, 3, 1)) { list }
}
test fun sortForIterable() {
val list : Iterable<Int> = listOf(2, 3, 1)
expect(arrayList(1, 2, 3)) { list.sort() }
expect(arrayList(2, 3, 1)) { list }
}
class IterableWrapper<T>(collection : Iterable<T>) : Iterable<T> {
private val collection = collection