Documentation ¶
Index ¶
- type ISlice
- type SliceIterator
- func (iter *SliceIterator[T]) Clone() iterator.ConstIterator[T]
- func (iter *SliceIterator[T]) Equal(other iterator.ConstIterator[T]) bool
- func (iter *SliceIterator[T]) IsValid() bool
- func (iter *SliceIterator[T]) IteratorAt(position int) iterator.RandomAccessIterator[T]
- func (iter *SliceIterator[T]) Next() iterator.ConstIterator[T]
- func (iter *SliceIterator[T]) Position() int
- func (iter *SliceIterator[T]) Prev() iterator.ConstBidIterator[T]
- func (iter *SliceIterator[T]) SetValue(val T)
- func (iter *SliceIterator[T]) Value() T
- type SliceWrapper
- func (s *SliceWrapper[T]) At(position int) T
- func (s *SliceWrapper[T]) Attach(newSlice []T)
- func (s *SliceWrapper[T]) Begin() *SliceIterator[T]
- func (s *SliceWrapper[T]) End() *SliceIterator[T]
- func (s *SliceWrapper[T]) First() *SliceIterator[T]
- func (s *SliceWrapper[T]) Last() *SliceIterator[T]
- func (s *SliceWrapper[T]) Len() int
- func (s *SliceWrapper[T]) Set(position int, val T)
- type T
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SliceIterator ¶
type SliceIterator[T any] struct { // contains filtered or unexported fields }
SliceIterator represents a slice iterator
func (*SliceIterator[T]) Clone ¶
func (iter *SliceIterator[T]) Clone() iterator.ConstIterator[T]
Clone clones the iterator into a new one
func (*SliceIterator[T]) Equal ¶
func (iter *SliceIterator[T]) Equal(other iterator.ConstIterator[T]) bool
Equal returns true if the iterator is equal to the passed iterator
func (*SliceIterator[T]) IsValid ¶
func (iter *SliceIterator[T]) IsValid() bool
IsValid returns trus if the iterator is valid, othterwise return false
func (*SliceIterator[T]) IteratorAt ¶
func (iter *SliceIterator[T]) IteratorAt(position int) iterator.RandomAccessIterator[T]
IteratorAt creates an iterator with the passed position
func (*SliceIterator[T]) Next ¶
func (iter *SliceIterator[T]) Next() iterator.ConstIterator[T]
Next moves the iterator's position to the next position, and returns itself
func (*SliceIterator[T]) Position ¶
func (iter *SliceIterator[T]) Position() int
Position returns the position of the iterator
func (*SliceIterator[T]) Prev ¶
func (iter *SliceIterator[T]) Prev() iterator.ConstBidIterator[T]
Prev move the iterator's position to the previous position, and return itself
func (*SliceIterator[T]) SetValue ¶
func (iter *SliceIterator[T]) SetValue(val T)
SetValue sets the value of the iterator point to
func (*SliceIterator[T]) Value ¶
func (iter *SliceIterator[T]) Value() T
Value returns the value of the iterator point to
type SliceWrapper ¶
type SliceWrapper[T any] struct { // contains filtered or unexported fields }
SliceWrapper wraps a slice in order to provide functions related to iterators
func NewSliceWrapper ¶
func NewSliceWrapper[T any](slice []T) *SliceWrapper[T]
NewSliceWrapper creates a SliceWrapper
func (*SliceWrapper[T]) At ¶
func (s *SliceWrapper[T]) At(position int) T
At returns the value at position
func (*SliceWrapper[T]) Attach ¶
func (s *SliceWrapper[T]) Attach(newSlice []T)
Attach update the internal slice to newSlice
func (*SliceWrapper[T]) Begin ¶
func (s *SliceWrapper[T]) Begin() *SliceIterator[T]
Begin returns the first iterator of s
func (*SliceWrapper[T]) End ¶
func (s *SliceWrapper[T]) End() *SliceIterator[T]
End returns the end iterator of s
func (*SliceWrapper[T]) First ¶
func (s *SliceWrapper[T]) First() *SliceIterator[T]
First returns the first iterator of s
func (*SliceWrapper[T]) Last ¶
func (s *SliceWrapper[T]) Last() *SliceIterator[T]
Last returns the last iterator of s
func (*SliceWrapper[T]) Set ¶
func (s *SliceWrapper[T]) Set(position int, val T)
Set sets value at position