feat: add Sequence.list method to collect elements into a new List
Implements a new `list` method on the Sequence class that iterates over all elements and returns them as a freshly created List object. Includes documentation with usage example and a test case using a custom TestSequence class to verify correct behavior.
This commit is contained in:
@@ -90,6 +90,14 @@ class Sequence {
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
list {
|
||||
var result = new List
|
||||
for (element in this) {
|
||||
result.add(element)
|
||||
}
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
class String is Sequence {
|
||||
|
||||
Reference in New Issue
Block a user