Skip to content

Commit

Permalink
Swap stub and example
Browse files Browse the repository at this point in the history
  • Loading branch information
BNAndras committed Sep 24, 2024
1 parent aab9960 commit 4fb492f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
16 changes: 15 additions & 1 deletion exercises/practice/strain/.meta/lib/example.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
class Strain {
// your code here...
List<T> keep<T>(List<T> list, bool Function(T) predicate) {
final result = <T>[];

for (final item in list) {
if (predicate(item)) {
result.add(item);
}
}

return result;
}

List<T> discard<T>(List<T> list, bool Function(T) predicate) {
return keep(list, (item) => !predicate(item));
}
}
16 changes: 1 addition & 15 deletions exercises/practice/strain/lib/strain.dart
Original file line number Diff line number Diff line change
@@ -1,17 +1,3 @@
class Strain {
List<T> keep<T>(List<T> list, bool Function(T) predicate) {
final result = <T>[];

for (final item in list) {
if (predicate(item)) {
result.add(item);
}
}

return result;
}

List<T> discard<T>(List<T> list, bool Function(T) predicate) {
return keep(list, (item) => !predicate(item));
}
// your code here...
}

0 comments on commit 4fb492f

Please sign in to comment.