Removed the iterator package

There is no need for it at the moment.
This commit is contained in:
Sasha Koshka 2023-01-12 14:33:30 -05:00
parent 84ea6178b0
commit 00a20c5e1c

View File

@ -1,30 +0,0 @@
package iterator
type Iterator[ELEMENT_TYPE any] struct {
index int
slice []ELEMENT_TYPE
}
func New[ELEMENT_TYPE any] (
slice []ELEMENT_TYPE,
) (
iterator Iterator[ELEMENT_TYPE],
) {
iterator.slice = slice
return
}
func (iterator *Iterator[ELEMENT_TYPE]) Length () (length int) {
return len(iterator.slice)
}
func (iterator *Iterator[ELEMENT_TYPE]) Next () (element ELEMENT_TYPE) {
if !iterator.MoreLeft() { return }
element = iterator.slice[iterator.index]
iterator.index ++
return
}
func (iterator *Iterator[ELEMENT_TYPE]) MoreLeft () (moreLeft bool) {
return iterator.index < len(iterator.slice)
}