array

package
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 28, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Array

type Array struct {
	// contains filtered or unexported fields
}

Array is a fixed size slice

func New

func New(size int) *Array

New creates a new array with passed size

func NewFromArray

func NewFromArray(other *Array) *Array

NewFromArray creates a new array from another array, and copy its values

func (*Array) At

func (a *Array) At(pos int) interface{}

At returns the value at position pos in the array

func (*Array) Back

func (a *Array) Back() interface{}

Back returns the last value in the array

func (*Array) Begin

func (a *Array) Begin() *ArrayIterator

Begin returns an iterator of the array with the first position

func (*Array) Data

func (a *Array) Data() []interface{}

Data returns the internal values of the array

func (*Array) Empty

func (a *Array) Empty() bool

Empty returns whether the array is empty or not

func (*Array) End

func (a *Array) End() *ArrayIterator

End returns an iterator of the array with the position a.Size()

func (*Array) Fill

func (a *Array) Fill(val interface{})

Fill fills Array a with value val

func (*Array) First

func (a *Array) First() *ArrayIterator

First returns an iterator of the array with the first position

func (*Array) Front

func (a *Array) Front() interface{}

Front returns the first value in the array

func (*Array) IterAt

func (a *Array) IterAt(pos int) *ArrayIterator

IterAt returns an iterator of the array with position pos

func (*Array) Last

func (a *Array) Last() *ArrayIterator

Last returns an iterator of the array with the last position

func (*Array) Set

func (a *Array) Set(pos int, val interface{})

Set sets value val to the position pos of the array

func (*Array) Size

func (a *Array) Size() int

Size returns number of elements within the array

func (*Array) String

func (a *Array) String() string

String returns a string representation of the array

func (*Array) SwapArray

func (a *Array) SwapArray(other *Array)

SwapArray swaps the values of two arrays

type ArrayIterator

type ArrayIterator struct {
	// contains filtered or unexported fields
}

ArrayIterator is an an implementation of Array iterator

func (*ArrayIterator) Clone

func (iter *ArrayIterator) Clone() iterator.ConstIterator

Clone clones the iterator to a new iterator

func (*ArrayIterator) Equal

func (iter *ArrayIterator) Equal(other iterator.ConstIterator) bool

Equal returns true if the iterator is equal to the passed iterator, otherwise returns false

func (*ArrayIterator) IsValid

func (iter *ArrayIterator) IsValid() bool

IsValid returns true if the iterator is valid, otherwise returns false

func (*ArrayIterator) IteratorAt

func (iter *ArrayIterator) IteratorAt(pos int) iterator.RandomAccessIterator

IteratorAt creates a new iterator with position pos

func (*ArrayIterator) Next

func (iter *ArrayIterator) Next() iterator.ConstIterator

Next moves the position of iterator to the next position and returns itself

func (*ArrayIterator) Position

func (iter *ArrayIterator) Position() int

Position returns the position of the iterator

func (*ArrayIterator) Prev

Prev moves the position of iterator to the previous position and returns itself

func (*ArrayIterator) SetValue

func (iter *ArrayIterator) SetValue(val interface{})

SetValue sets the value of the array at the position of the iterator point to

func (*ArrayIterator) Value

func (iter *ArrayIterator) Value() interface{}

Value returns the value of array at the position of the iterator point to

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL