Iterators: Removed NewAnyIterator(), added NewIterator()
This commit is contained in:
+1
-16
@@ -62,27 +62,12 @@ func NewArrayIterator(array []any) (it *ListIterator) {
|
||||
return
|
||||
}
|
||||
|
||||
func NewAnyIterator(value any) (it *ListIterator) {
|
||||
if value == nil {
|
||||
it = NewArrayIterator([]any{})
|
||||
} else if list, ok := value.(*ListType); ok {
|
||||
it = NewListIterator(list, nil)
|
||||
} else if array, ok := value.([]any); ok {
|
||||
it = NewArrayIterator(array)
|
||||
} else if it1, ok := value.(*ListIterator); ok {
|
||||
it = it1
|
||||
} else {
|
||||
it = NewArrayIterator([]any{value})
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (it *ListIterator) String() string {
|
||||
var l = 0
|
||||
if it.a != nil {
|
||||
l = len(*it.a)
|
||||
}
|
||||
return fmt.Sprintf("$(#%d)", l)
|
||||
return fmt.Sprintf("$([#%d])", l)
|
||||
}
|
||||
|
||||
func (it *ListIterator) TypeName() string {
|
||||
|
||||
Reference in New Issue
Block a user