Documentation
¶
Index ¶
- type Vector
- func (v *Vector) Add(value interface{})
- func (v *Vector) Clear()
- func (v *Vector) Empty() bool
- func (v *Vector) Get(index int) (interface{}, error)
- func (v *Vector) GetOrDefault(index int, def interface{}) interface{}
- func (v *Vector) GetOrNil(index int) interface{}
- func (v *Vector) Insert(index int, value interface{}) error
- func (v *Vector) Remove(value interface{}) interface{}
- func (v *Vector) RemoveAt(index int) (interface{}, error)
- func (v *Vector) Set(index int, value interface{}) (interface{}, error)
- func (v *Vector) SetOrDefault(index int, value interface{}, def interface{}) interface{}
- func (v *Vector) SetOrNil(index int, value interface{}) interface{}
- func (v *Vector) String() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Vector ¶
Vector is an dynamic array implementation structure. It is basically array, but can resized. Size is changed automatically.
func (*Vector) Add ¶
func (v *Vector) Add(value interface{})
Add method adds a new value at the last of the dynamic array.
func (*Vector) Clear ¶
func (v *Vector) Clear()
Clear method removes all values in the dynamic array.
func (*Vector) Get ¶
Get method returns a value at the given index. If index is out of range, throws error.
func (*Vector) GetOrDefault ¶
GetOrDefault method return a value at the given index. If index is out of bounds, it returns given default value.
func (*Vector) GetOrNil ¶
GetOrNil method return a value at the given index. If index is out of range, it returns nil.
func (*Vector) Insert ¶
Insert method add a new value at the given index. If index equals to size, adds at the last. If index is out of range, returns error.
func (*Vector) Remove ¶
func (v *Vector) Remove(value interface{}) interface{}
Remove method removes a first value that is matched to given value. And also it returns removed value. If there is no matched value, returns nil.
func (*Vector) RemoveAt ¶
RemoveAt method removes a value at the given index. And also it returns removed value. If given index is out of range, returns error.
func (*Vector) Set ¶
Set method replaces a value at the given index. And also it returns old value. If index is out of range, returns error.
func (*Vector) SetOrDefault ¶
SetOrDefault method replaces a value at the given index. And also it returns old value. If index is out of range, returns given default value.