Documentation ¶
Index ¶
- Constants
- func GetBucketKey(key string) int
- type ArrayList
- func (list *ArrayList) Append(val ...interface{})
- func (list *ArrayList) Clear()
- func (list *ArrayList) Delete(index int) error
- func (list *ArrayList) Get(index int) (interface{}, error)
- func (list *ArrayList) Insert(index int, val interface{}) error
- func (list *ArrayList) Set(index int, newValue interface{}) error
- func (list *ArrayList) Size() int
- func (list *ArrayList) String() string
- type HashMap
- type List
- type Node
- type Value
Constants ¶
View Source
const BucketsCount = 100
桶的格子数
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ArrayList ¶
type ArrayList struct { DataStore []interface{} TheSize int }
数据结构
func (*ArrayList) Clear ¶
func (list *ArrayList) Clear()
清空
To remove all elements, simply set the slice to nil. a := []string{"A", "B", "C", "D", "E"} a = nil fmt.Println(a, len(a), cap(a)) // [] 0 0
Keep allocated memory . To keep the underlying array, slice the slice to zero length. a := []string{"A", "B", "C", "D", "E"} a = a[:0] fmt.Println(a, len(a), cap(a)) // [] 0 5 If the slice is extended again, the original data reappears. fmt.Println(a[:2]) // [A B]
type List ¶
type List interface { Size() int Get(index int) (interface{}, error) Set(index int, newValue interface{}) error Insert(index int, val interface{}) error Append(val ...interface{}) Delete(index int) error String() string Clear() }
接口
Click to show internal directories.
Click to hide internal directories.