You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
var abc =mutableListOf(["a", "b", "c"]);
finalKMutableIterator<String> i = abc.iterator();
assert(i.next() =="a");
i.remove();
assert(abc[0] =="b"); // Failed assertion: 'abc[0] == "b"': is not true.
abc[0] is still "a" because remove doesn't remove the item from the actual collection. Instead, it gets removed from the internal copy inside the iterator.
To fix this problem a big refactoring is required so that remove actually removed the item from the original collection.
abc[0]
is still"a"
because remove doesn't remove the item from the actual collection. Instead, it gets removed from the internal copy inside the iterator.To fix this problem a big refactoring is required so that remove actually removed the item from the original collection.
This is how kotlin solves this
The text was updated successfully, but these errors were encountered: