Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Throw KMutableIterator.remove until implemented correctly #6

Merged
merged 1 commit into from Dec 2, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 6 additions & 1 deletion lib/src/collection/iterator.dart
Expand Up @@ -27,7 +27,12 @@ class DartIterator<T> implements KMutableIterator<T> {

@override
void remove() {
list.remove(lastRet);
// removing from list is wrong because is is a copy of the original list.
// remove should modify the underlying list, not the copy
// see how kotlin solved this:
// https://github.com/JetBrains/kotlin/blob/ba6da7c40a6cc502508faf6e04fa105b96bc7777/libraries/stdlib/js/src/kotlin/collections/InternalHashCodeMap.kt
throw UnimplementedError(
"remove() in not yet implemented. Please vote for https://github.com/passsy/dart_kollection/issues/5 for prioritization");
}
}

Expand Down
7 changes: 6 additions & 1 deletion lib/src/collection/set_mutable.dart
Expand Up @@ -122,6 +122,11 @@ class _MutableSetIterator<T> extends KMutableIterator<T> {

@override
void remove() {
_set.remove(lastReturned);
// removing from list is wrong because is is a copy of the original list.
// remove should modify the underlying list, not the copy
// see how kotlin solved this:
// https://github.com/JetBrains/kotlin/blob/ba6da7c40a6cc502508faf6e04fa105b96bc7777/libraries/stdlib/js/src/kotlin/collections/InternalHashCodeMap.kt
throw UnimplementedError(
"remove() in not yet implemented. Please vote for https://github.com/passsy/dart_kollection/issues/5 for prioritization");
}
}
1 change: 1 addition & 0 deletions lib/src/k_collection_mutable.dart
Expand Up @@ -7,6 +7,7 @@ import 'package:dart_kollection/dart_kollection.dart';
*/
abstract class KMutableCollection<T> implements KCollection<T>, KMutableIterable<T> {
// Query Operations
@override
KMutableIterator<T> iterator();

// Modification Operations
Expand Down