Provide Iterators for String and JArray
A StringIterator is a data structure that lets us view a part of a String as a list.
With large Strings, performing list work on Strings can be expensive, because more recent JVMs implement the substring operation via copying.
Construction, ListView.drop, ListView.take, ListView.head and ListView.tail on a StringIterator are O(1) operations. The drawback is that it holds on to the underlying String.
access field at
Construct a StringIterator from a String
access field limit
access field string
realize the substring indicated by this iterator
A ArrayIterator is a data structure that lets us view a part of a JArray as a list.
With large JArrays, doing ListSource.toList and iterating through the list can get expensive memory-wise.
Construction, ListView.drop, ListView.take, ListView.head and ListView.tail on a ArrayIterator are O(1) operations with a minimal memory overhead. The drawback is that it holds on to the underlying JArray.
access field array
access field at
make iterator from JArray
access field limit
realize the subarray indicated by this iterator
concatenate the strings described by two iterators
inherited from ListMonoid.concat
drop at most n characters by advancing the start index.
Can be abused to "go back" towards the beginning of the String
create an empty ArrayIterator
inherited from ListView.head
length
is it null?
inherited from ListView.tail
sets the ListView.length of the projection to n or 0, if n is negative.
inherited from ListView.toList
deconstruct
drop at most n characters by advancing the start index.
Can be abused to "go back" towards the beginning of the String
empty StringIterator
inherited from ListView.head
length
is it null?
inherited from ListView.tail
sets the ListView.length of the projection to n or 0, if n is negative.
inherited from ListView.toList
deconstruct
ListView_ArrayIterator.length, ArrayIterator.limit, ArrayIterator.at
ListView_StringIterator.length, StringIterator.limit, StringIterator.at
ArrayIterator.has$at, ArrayIterator.has$limit, ArrayIterator.has$array, StringIterator.has$string, StringIterator.has$at, StringIterator.has$limit