comment update for container

This commit is contained in:
John
2019-11-30 18:33:51 +08:00
parent 459c69839a
commit be4bf39719
23 changed files with 78 additions and 78 deletions

View File

@ -24,7 +24,7 @@ type Array struct {
}
// New creates and returns an empty array.
// The parameter <safe> used to specify whether using array in concurrent-safety,
// The parameter <safe> is used to specify whether using array in concurrent-safety,
// which is false in default.
func New(safe ...bool) *Array {
return NewArraySize(0, 0, safe...)
@ -36,7 +36,7 @@ func NewArray(safe ...bool) *Array {
}
// NewArraySize create and returns an array with given size and cap.
// The parameter <safe> used to specify whether using array in concurrent-safety,
// The parameter <safe> is used to specify whether using array in concurrent-safety,
// which is false in default.
func NewArraySize(size int, cap int, safe ...bool) *Array {
return &Array{
@ -56,7 +56,7 @@ func NewFromCopy(array []interface{}, safe ...bool) *Array {
}
// NewArrayFrom creates and returns an array with given slice <array>.
// The parameter <safe> used to specify whether using array in concurrent-safety,
// The parameter <safe> is used to specify whether using array in concurrent-safety,
// which is false in default.
func NewArrayFrom(array []interface{}, safe ...bool) *Array {
return &Array{
@ -66,7 +66,7 @@ func NewArrayFrom(array []interface{}, safe ...bool) *Array {
}
// NewArrayFromCopy creates and returns an array from a copy of given slice <array>.
// The parameter <safe> used to specify whether using array in concurrent-safety,
// The parameter <safe> is used to specify whether using array in concurrent-safety,
// which is false in default.
func NewArrayFromCopy(array []interface{}, safe ...bool) *Array {
newArray := make([]interface{}, len(array))

View File

@ -23,14 +23,14 @@ type IntArray struct {
}
// NewIntArray creates and returns an empty array.
// The parameter <safe> used to specify whether using array in concurrent-safety,
// The parameter <safe> is used to specify whether using array in concurrent-safety,
// which is false in default.
func NewIntArray(safe ...bool) *IntArray {
return NewIntArraySize(0, 0, safe...)
}
// NewIntArraySize create and returns an array with given size and cap.
// The parameter <safe> used to specify whether using array in concurrent-safety,
// The parameter <safe> is used to specify whether using array in concurrent-safety,
// which is false in default.
func NewIntArraySize(size int, cap int, safe ...bool) *IntArray {
return &IntArray{
@ -40,7 +40,7 @@ func NewIntArraySize(size int, cap int, safe ...bool) *IntArray {
}
// NewIntArrayFrom creates and returns an array with given slice <array>.
// The parameter <safe> used to specify whether using array in concurrent-safety,
// The parameter <safe> is used to specify whether using array in concurrent-safety,
// which is false in default.
func NewIntArrayFrom(array []int, safe ...bool) *IntArray {
return &IntArray{
@ -50,7 +50,7 @@ func NewIntArrayFrom(array []int, safe ...bool) *IntArray {
}
// NewIntArrayFromCopy creates and returns an array from a copy of given slice <array>.
// The parameter <safe> used to specify whether using array in concurrent-safety,
// The parameter <safe> is used to specify whether using array in concurrent-safety,
// which is false in default.
func NewIntArrayFromCopy(array []int, safe ...bool) *IntArray {
newArray := make([]int, len(array))

View File

@ -25,14 +25,14 @@ type StrArray struct {
}
// NewStrArray creates and returns an empty array.
// The parameter <safe> used to specify whether using array in concurrent-safety,
// The parameter <safe> is used to specify whether using array in concurrent-safety,
// which is false in default.
func NewStrArray(safe ...bool) *StrArray {
return NewStrArraySize(0, 0, safe...)
}
// NewStrArraySize create and returns an array with given size and cap.
// The parameter <safe> used to specify whether using array in concurrent-safety,
// The parameter <safe> is used to specify whether using array in concurrent-safety,
// which is false in default.
func NewStrArraySize(size int, cap int, safe ...bool) *StrArray {
return &StrArray{
@ -42,7 +42,7 @@ func NewStrArraySize(size int, cap int, safe ...bool) *StrArray {
}
// NewStrArrayFrom creates and returns an array with given slice <array>.
// The parameter <safe> used to specify whether using array in concurrent-safety,
// The parameter <safe> is used to specify whether using array in concurrent-safety,
// which is false in default.
func NewStrArrayFrom(array []string, safe ...bool) *StrArray {
return &StrArray{
@ -52,7 +52,7 @@ func NewStrArrayFrom(array []string, safe ...bool) *StrArray {
}
// NewStrArrayFromCopy creates and returns an array from a copy of given slice <array>.
// The parameter <safe> used to specify whether using array in concurrent-safety,
// The parameter <safe> is used to specify whether using array in concurrent-safety,
// which is false in default.
func NewStrArrayFromCopy(array []string, safe ...bool) *StrArray {
newArray := make([]string, len(array))

View File

@ -29,7 +29,7 @@ type SortedArray struct {
}
// NewSortedArray creates and returns an empty sorted array.
// The parameter <safe> used to specify whether using array in concurrent-safety, which is false in default.
// The parameter <safe> is used to specify whether using array in concurrent-safety, which is false in default.
// The parameter <comparator> used to compare values to sort in array,
// if it returns value < 0, means v1 < v2;
// if it returns value = 0, means v1 = v2;
@ -39,7 +39,7 @@ func NewSortedArray(comparator func(a, b interface{}) int, safe ...bool) *Sorted
}
// NewSortedArraySize create and returns an sorted array with given size and cap.
// The parameter <safe> used to specify whether using array in concurrent-safety,
// The parameter <safe> is used to specify whether using array in concurrent-safety,
// which is false in default.
func NewSortedArraySize(cap int, comparator func(a, b interface{}) int, safe ...bool) *SortedArray {
return &SortedArray{
@ -51,7 +51,7 @@ func NewSortedArraySize(cap int, comparator func(a, b interface{}) int, safe ...
}
// NewSortedArrayFrom creates and returns an sorted array with given slice <array>.
// The parameter <safe> used to specify whether using array in concurrent-safety,
// The parameter <safe> is used to specify whether using array in concurrent-safety,
// which is false in default.
func NewSortedArrayFrom(array []interface{}, comparator func(a, b interface{}) int, safe ...bool) *SortedArray {
a := NewSortedArraySize(0, comparator, safe...)
@ -63,7 +63,7 @@ func NewSortedArrayFrom(array []interface{}, comparator func(a, b interface{}) i
}
// NewSortedArrayFromCopy creates and returns an sorted array from a copy of given slice <array>.
// The parameter <safe> used to specify whether using array in concurrent-safety,
// The parameter <safe> is used to specify whether using array in concurrent-safety,
// which is false in default.
func NewSortedArrayFromCopy(array []interface{}, comparator func(a, b interface{}) int, safe ...bool) *SortedArray {
newArray := make([]interface{}, len(array))

View File

@ -27,14 +27,14 @@ type SortedIntArray struct {
}
// NewSortedIntArray creates and returns an empty sorted array.
// The parameter <safe> used to specify whether using array in concurrent-safety,
// The parameter <safe> is used to specify whether using array in concurrent-safety,
// which is false in default.
func NewSortedIntArray(safe ...bool) *SortedIntArray {
return NewSortedIntArraySize(0, safe...)
}
// NewSortedIntArrayComparator creates and returns an empty sorted array with specified comparator.
// The parameter <safe> used to specify whether using array in concurrent-safety which is false in default.
// The parameter <safe> is used to specify whether using array in concurrent-safety which is false in default.
func NewSortedIntArrayComparator(comparator func(a, b int) int, safe ...bool) *SortedIntArray {
array := NewSortedIntArray(safe...)
array.comparator = comparator
@ -42,7 +42,7 @@ func NewSortedIntArrayComparator(comparator func(a, b int) int, safe ...bool) *S
}
// NewSortedIntArraySize create and returns an sorted array with given size and cap.
// The parameter <safe> used to specify whether using array in concurrent-safety,
// The parameter <safe> is used to specify whether using array in concurrent-safety,
// which is false in default.
func NewSortedIntArraySize(cap int, safe ...bool) *SortedIntArray {
return &SortedIntArray{
@ -54,7 +54,7 @@ func NewSortedIntArraySize(cap int, safe ...bool) *SortedIntArray {
}
// NewIntArrayFrom creates and returns an sorted array with given slice <array>.
// The parameter <safe> used to specify whether using array in concurrent-safety,
// The parameter <safe> is used to specify whether using array in concurrent-safety,
// which is false in default.
func NewSortedIntArrayFrom(array []int, safe ...bool) *SortedIntArray {
a := NewSortedIntArraySize(0, safe...)
@ -64,7 +64,7 @@ func NewSortedIntArrayFrom(array []int, safe ...bool) *SortedIntArray {
}
// NewSortedIntArrayFromCopy creates and returns an sorted array from a copy of given slice <array>.
// The parameter <safe> used to specify whether using array in concurrent-safety,
// The parameter <safe> is used to specify whether using array in concurrent-safety,
// which is false in default.
func NewSortedIntArrayFromCopy(array []int, safe ...bool) *SortedIntArray {
newArray := make([]int, len(array))

View File

@ -28,14 +28,14 @@ type SortedStrArray struct {
}
// NewSortedStrArray creates and returns an empty sorted array.
// The parameter <safe> used to specify whether using array in concurrent-safety,
// The parameter <safe> is used to specify whether using array in concurrent-safety,
// which is false in default.
func NewSortedStrArray(safe ...bool) *SortedStrArray {
return NewSortedStrArraySize(0, safe...)
}
// NewSortedStrArrayComparator creates and returns an empty sorted array with specified comparator.
// The parameter <safe> used to specify whether using array in concurrent-safety which is false in default.
// The parameter <safe> is used to specify whether using array in concurrent-safety which is false in default.
func NewSortedStrArrayComparator(comparator func(a, b string) int, safe ...bool) *SortedStrArray {
array := NewSortedStrArray(safe...)
array.comparator = comparator
@ -43,7 +43,7 @@ func NewSortedStrArrayComparator(comparator func(a, b string) int, safe ...bool)
}
// NewSortedStrArraySize create and returns an sorted array with given size and cap.
// The parameter <safe> used to specify whether using array in concurrent-safety,
// The parameter <safe> is used to specify whether using array in concurrent-safety,
// which is false in default.
func NewSortedStrArraySize(cap int, safe ...bool) *SortedStrArray {
return &SortedStrArray{
@ -55,7 +55,7 @@ func NewSortedStrArraySize(cap int, safe ...bool) *SortedStrArray {
}
// NewSortedStrArrayFrom creates and returns an sorted array with given slice <array>.
// The parameter <safe> used to specify whether using array in concurrent-safety,
// The parameter <safe> is used to specify whether using array in concurrent-safety,
// which is false in default.
func NewSortedStrArrayFrom(array []string, safe ...bool) *SortedStrArray {
a := NewSortedStrArraySize(0, safe...)
@ -65,7 +65,7 @@ func NewSortedStrArrayFrom(array []string, safe ...bool) *SortedStrArray {
}
// NewSortedStrArrayFromCopy creates and returns an sorted array from a copy of given slice <array>.
// The parameter <safe> used to specify whether using array in concurrent-safety,
// The parameter <safe> is used to specify whether using array in concurrent-safety,
// which is false in default.
func NewSortedStrArrayFromCopy(array []string, safe ...bool) *SortedStrArray {
newArray := make([]string, len(array))

View File

@ -36,7 +36,7 @@ func New(safe ...bool) *List {
}
// NewFrom creates and returns a list from a copy of given slice <array>.
// The parameter <safe> used to specify whether using list in concurrent-safety,
// The parameter <safe> is used to specify whether using list in concurrent-safety,
// which is false in default.
func NewFrom(array []interface{}, safe ...bool) *List {
l := list.New()

View File

@ -11,33 +11,33 @@ package gmap
type Map = AnyAnyMap
type HashMap = AnyAnyMap
// New returns an empty hash map.
// The parameter <safe> used to specify whether using map in concurrent-safety,
// New creates and returns an empty hash map.
// The parameter <safe> is used to specify whether using map in concurrent-safety,
// which is false in default.
func New(safe ...bool) *Map {
return NewAnyAnyMap(safe...)
}
// NewFrom returns a hash map from given map <data>.
// NewFrom creates and returns a hash map from given map <data>.
// Note that, the param <data> map will be set as the underlying data map(no deep copy),
// there might be some concurrent-safe issues when changing the map outside.
// The parameter <safe> used to specify whether using tree in concurrent-safety,
// The parameter <safe> is used to specify whether using tree in concurrent-safety,
// which is false in default.
func NewFrom(data map[interface{}]interface{}, safe ...bool) *Map {
return NewAnyAnyMapFrom(data, safe...)
}
// NewHashMap returns an empty hash map.
// The parameter <safe> used to specify whether using map in concurrent-safety,
// NewHashMap creates and returns an empty hash map.
// The parameter <safe> is used to specify whether using map in concurrent-safety,
// which is false in default.
func NewHashMap(safe ...bool) *Map {
return NewAnyAnyMap(safe...)
}
// NewHashMapFrom returns a hash map from given map <data>.
// NewHashMapFrom creates and returns a hash map from given map <data>.
// Note that, the param <data> map will be set as the underlying data map(no deep copy),
// there might be some concurrent-safe issues when changing the map outside.
// The parameter <safe> used to specify whether using tree in concurrent-safety,
// The parameter <safe> is used to specify whether using tree in concurrent-safety,
// which is false in default.
func NewHashMapFrom(data map[interface{}]interface{}, safe ...bool) *Map {
return NewAnyAnyMapFrom(data, safe...)

View File

@ -22,8 +22,8 @@ type AnyAnyMap struct {
data map[interface{}]interface{}
}
// NewAnyAnyMap returns an empty hash map.
// The parameter <safe> used to specify whether using map in concurrent-safety,
// NewAnyAnyMap creates and returns an empty hash map.
// The parameter <safe> is used to specify whether using map in concurrent-safety,
// which is false in default.
func NewAnyAnyMap(safe ...bool) *AnyAnyMap {
return &AnyAnyMap{
@ -32,7 +32,7 @@ func NewAnyAnyMap(safe ...bool) *AnyAnyMap {
}
}
// NewAnyAnyMapFrom returns a hash map from given map <data>.
// NewAnyAnyMapFrom creates and returns a hash map from given map <data>.
// Note that, the param <data> map will be set as the underlying data map(no deep copy),
// there might be some concurrent-safe issues when changing the map outside.
func NewAnyAnyMapFrom(data map[interface{}]interface{}, safe ...bool) *AnyAnyMap {
@ -75,7 +75,7 @@ func (m *AnyAnyMap) Map() map[interface{}]interface{} {
return data
}
// MapCopy returns a copy of the data of the hash map.
// MapCopy returns a copy of the underlying data of the hash map.
func (m *AnyAnyMap) MapCopy() map[interface{}]interface{} {
m.mu.RLock()
defer m.mu.RUnlock()
@ -86,7 +86,7 @@ func (m *AnyAnyMap) MapCopy() map[interface{}]interface{} {
return data
}
// MapStrAny returns a copy of the data of the map as map[string]interface{}.
// MapStrAny returns a copy of the underlying data of the map as map[string]interface{}.
func (m *AnyAnyMap) MapStrAny() map[string]interface{} {
m.mu.RLock()
data := make(map[string]interface{}, len(m.data))

View File

@ -23,7 +23,7 @@ type IntAnyMap struct {
}
// NewIntAnyMap returns an empty IntAnyMap object.
// The parameter <safe> used to specify whether using map in concurrent-safety,
// The parameter <safe> is used to specify whether using map in concurrent-safety,
// which is false in default.
func NewIntAnyMap(safe ...bool) *IntAnyMap {
return &IntAnyMap{
@ -32,7 +32,7 @@ func NewIntAnyMap(safe ...bool) *IntAnyMap {
}
}
// NewIntAnyMapFrom returns a hash map from given map <data>.
// NewIntAnyMapFrom creates and returns a hash map from given map <data>.
// Note that, the param <data> map will be set as the underlying data map(no deep copy),
// there might be some concurrent-safe issues when changing the map outside.
func NewIntAnyMapFrom(data map[int]interface{}, safe ...bool) *IntAnyMap {
@ -75,7 +75,7 @@ func (m *IntAnyMap) Map() map[int]interface{} {
return data
}
// MapStrAny returns a copy of the data of the map as map[string]interface{}.
// MapStrAny returns a copy of the underlying data of the map as map[string]interface{}.
func (m *IntAnyMap) MapStrAny() map[string]interface{} {
m.mu.RLock()
data := make(map[string]interface{}, len(m.data))
@ -86,7 +86,7 @@ func (m *IntAnyMap) MapStrAny() map[string]interface{} {
return data
}
// MapCopy returns a copy of the data of the hash map.
// MapCopy returns a copy of the underlying data of the hash map.
func (m *IntAnyMap) MapCopy() map[int]interface{} {
m.mu.RLock()
defer m.mu.RUnlock()

View File

@ -21,7 +21,7 @@ type IntIntMap struct {
}
// NewIntIntMap returns an empty IntIntMap object.
// The parameter <safe> used to specify whether using map in concurrent-safety,
// The parameter <safe> is used to specify whether using map in concurrent-safety,
// which is false in default.
func NewIntIntMap(safe ...bool) *IntIntMap {
return &IntIntMap{
@ -30,7 +30,7 @@ func NewIntIntMap(safe ...bool) *IntIntMap {
}
}
// NewIntIntMapFrom returns a hash map from given map <data>.
// NewIntIntMapFrom creates and returns a hash map from given map <data>.
// Note that, the param <data> map will be set as the underlying data map(no deep copy),
// there might be some concurrent-safe issues when changing the map outside.
func NewIntIntMapFrom(data map[int]int, safe ...bool) *IntIntMap {
@ -73,7 +73,7 @@ func (m *IntIntMap) Map() map[int]int {
return data
}
// MapStrAny returns a copy of the data of the map as map[string]interface{}.
// MapStrAny returns a copy of the underlying data of the map as map[string]interface{}.
func (m *IntIntMap) MapStrAny() map[string]interface{} {
m.mu.RLock()
data := make(map[string]interface{}, len(m.data))
@ -84,7 +84,7 @@ func (m *IntIntMap) MapStrAny() map[string]interface{} {
return data
}
// MapCopy returns a copy of the data of the hash map.
// MapCopy returns a copy of the underlying data of the hash map.
func (m *IntIntMap) MapCopy() map[int]int {
m.mu.RLock()
defer m.mu.RUnlock()

View File

@ -21,7 +21,7 @@ type IntStrMap struct {
}
// NewIntStrMap returns an empty IntStrMap object.
// The parameter <safe> used to specify whether using map in concurrent-safety,
// The parameter <safe> is used to specify whether using map in concurrent-safety,
// which is false in default.
func NewIntStrMap(safe ...bool) *IntStrMap {
return &IntStrMap{
@ -30,7 +30,7 @@ func NewIntStrMap(safe ...bool) *IntStrMap {
}
}
// NewIntStrMapFrom returns a hash map from given map <data>.
// NewIntStrMapFrom creates and returns a hash map from given map <data>.
// Note that, the param <data> map will be set as the underlying data map(no deep copy),
// there might be some concurrent-safe issues when changing the map outside.
func NewIntStrMapFrom(data map[int]string, safe ...bool) *IntStrMap {
@ -73,7 +73,7 @@ func (m *IntStrMap) Map() map[int]string {
return data
}
// MapStrAny returns a copy of the data of the map as map[string]interface{}.
// MapStrAny returns a copy of the underlying data of the map as map[string]interface{}.
func (m *IntStrMap) MapStrAny() map[string]interface{} {
m.mu.RLock()
data := make(map[string]interface{}, len(m.data))
@ -84,7 +84,7 @@ func (m *IntStrMap) MapStrAny() map[string]interface{} {
return data
}
// MapCopy returns a copy of the data of the hash map.
// MapCopy returns a copy of the underlying data of the hash map.
func (m *IntStrMap) MapCopy() map[int]string {
m.mu.RLock()
defer m.mu.RUnlock()

View File

@ -23,7 +23,7 @@ type StrAnyMap struct {
}
// NewStrAnyMap returns an empty StrAnyMap object.
// The parameter <safe> used to specify whether using map in concurrent-safety,
// The parameter <safe> is used to specify whether using map in concurrent-safety,
// which is false in default.
func NewStrAnyMap(safe ...bool) *StrAnyMap {
return &StrAnyMap{
@ -32,7 +32,7 @@ func NewStrAnyMap(safe ...bool) *StrAnyMap {
}
}
// NewStrAnyMapFrom returns a hash map from given map <data>.
// NewStrAnyMapFrom creates and returns a hash map from given map <data>.
// Note that, the param <data> map will be set as the underlying data map(no deep copy),
// there might be some concurrent-safe issues when changing the map outside.
func NewStrAnyMapFrom(data map[string]interface{}, safe ...bool) *StrAnyMap {
@ -75,12 +75,12 @@ func (m *StrAnyMap) Map() map[string]interface{} {
return data
}
// MapStrAny returns a copy of the data of the map as map[string]interface{}.
// MapStrAny returns a copy of the underlying data of the map as map[string]interface{}.
func (m *StrAnyMap) MapStrAny() map[string]interface{} {
return m.Map()
}
// MapCopy returns a copy of the data of the hash map.
// MapCopy returns a copy of the underlying data of the hash map.
func (m *StrAnyMap) MapCopy() map[string]interface{} {
m.mu.RLock()
defer m.mu.RUnlock()

View File

@ -21,7 +21,7 @@ type StrIntMap struct {
}
// NewStrIntMap returns an empty StrIntMap object.
// The parameter <safe> used to specify whether using map in concurrent-safety,
// The parameter <safe> is used to specify whether using map in concurrent-safety,
// which is false in default.
func NewStrIntMap(safe ...bool) *StrIntMap {
return &StrIntMap{
@ -30,7 +30,7 @@ func NewStrIntMap(safe ...bool) *StrIntMap {
}
}
// NewStrIntMapFrom returns a hash map from given map <data>.
// NewStrIntMapFrom creates and returns a hash map from given map <data>.
// Note that, the param <data> map will be set as the underlying data map(no deep copy),
// there might be some concurrent-safe issues when changing the map outside.
func NewStrIntMapFrom(data map[string]int, safe ...bool) *StrIntMap {
@ -73,7 +73,7 @@ func (m *StrIntMap) Map() map[string]int {
return data
}
// MapStrAny returns a copy of the data of the map as map[string]interface{}.
// MapStrAny returns a copy of the underlying data of the map as map[string]interface{}.
func (m *StrIntMap) MapStrAny() map[string]interface{} {
m.mu.RLock()
data := make(map[string]interface{}, len(m.data))
@ -84,7 +84,7 @@ func (m *StrIntMap) MapStrAny() map[string]interface{} {
return data
}
// MapCopy returns a copy of the data of the hash map.
// MapCopy returns a copy of the underlying data of the hash map.
func (m *StrIntMap) MapCopy() map[string]int {
m.mu.RLock()
defer m.mu.RUnlock()

View File

@ -21,7 +21,7 @@ type StrStrMap struct {
}
// NewStrStrMap returns an empty StrStrMap object.
// The parameter <safe> used to specify whether using map in concurrent-safety,
// The parameter <safe> is used to specify whether using map in concurrent-safety,
// which is false in default.
func NewStrStrMap(safe ...bool) *StrStrMap {
return &StrStrMap{
@ -30,7 +30,7 @@ func NewStrStrMap(safe ...bool) *StrStrMap {
}
}
// NewStrStrMapFrom returns a hash map from given map <data>.
// NewStrStrMapFrom creates and returns a hash map from given map <data>.
// Note that, the param <data> map will be set as the underlying data map(no deep copy),
// there might be some concurrent-safe issues when changing the map outside.
func NewStrStrMapFrom(data map[string]string, safe ...bool) *StrStrMap {
@ -73,7 +73,7 @@ func (m *StrStrMap) Map() map[string]string {
return data
}
// MapStrAny returns a copy of the data of the map as map[string]interface{}.
// MapStrAny returns a copy of the underlying data of the map as map[string]interface{}.
func (m *StrStrMap) MapStrAny() map[string]interface{} {
m.mu.RLock()
data := make(map[string]interface{}, len(m.data))
@ -84,7 +84,7 @@ func (m *StrStrMap) MapStrAny() map[string]interface{} {
return data
}
// MapCopy returns a copy of the data of the hash map.
// MapCopy returns a copy of the underlying data of the hash map.
func (m *StrStrMap) MapCopy() map[string]string {
m.mu.RLock()
defer m.mu.RUnlock()

View File

@ -31,7 +31,7 @@ type gListMapNode struct {
// NewListMap returns an empty link map.
// ListMap is backed by a hash table to store values and doubly-linked list to store ordering.
// The parameter <safe> used to specify whether using map in concurrent-safety,
// The parameter <safe> is used to specify whether using map in concurrent-safety,
// which is false in default.
func NewListMap(safe ...bool) *ListMap {
return &ListMap{
@ -107,7 +107,7 @@ func (m *ListMap) Replace(data map[interface{}]interface{}) {
m.mu.Unlock()
}
// Map returns a copy of the data of the map.
// Map returns a copy of the underlying data of the map.
func (m *ListMap) Map() map[interface{}]interface{} {
m.mu.RLock()
node := (*gListMapNode)(nil)
@ -121,7 +121,7 @@ func (m *ListMap) Map() map[interface{}]interface{} {
return data
}
// MapStrAny returns a copy of the data of the map as map[string]interface{}.
// MapStrAny returns a copy of the underlying data of the map as map[string]interface{}.
func (m *ListMap) MapStrAny() map[string]interface{} {
m.mu.RLock()
node := (*gListMapNode)(nil)

View File

@ -14,7 +14,7 @@ import (
type TreeMap = gtree.RedBlackTree
// NewTreeMap instantiates a tree map with the custom comparator.
// The parameter <safe> used to specify whether using tree in concurrent-safety,
// The parameter <safe> is used to specify whether using tree in concurrent-safety,
// which is false in default.
func NewTreeMap(comparator func(v1, v2 interface{}) int, safe ...bool) *TreeMap {
return gtree.NewRedBlackTree(comparator, safe...)
@ -23,7 +23,7 @@ func NewTreeMap(comparator func(v1, v2 interface{}) int, safe ...bool) *TreeMap
// NewTreeMapFrom instantiates a tree map with the custom comparator and <data> map.
// Note that, the param <data> map will be set as the underlying data map(no deep copy),
// there might be some concurrent-safe issues when changing the map outside.
// The parameter <safe> used to specify whether using tree in concurrent-safety,
// The parameter <safe> is used to specify whether using tree in concurrent-safety,
// which is false in default.
func NewTreeMapFrom(comparator func(v1, v2 interface{}) int, data map[interface{}]interface{}, safe ...bool) *TreeMap {
return gtree.NewRedBlackTreeFrom(comparator, data, safe...)

View File

@ -21,7 +21,7 @@ type Set struct {
}
// New create and returns a new set, which contains un-repeated items.
// The parameter <safe> used to specify whether using set in concurrent-safety,
// The parameter <safe> is used to specify whether using set in concurrent-safety,
// which is false in default.
func New(safe ...bool) *Set {
return NewSet(safe...)

View File

@ -20,7 +20,7 @@ type IntSet struct {
}
// New create and returns a new set, which contains un-repeated items.
// The parameter <safe> used to specify whether using set in concurrent-safety,
// The parameter <safe> is used to specify whether using set in concurrent-safety,
// which is false in default.
func NewIntSet(safe ...bool) *IntSet {
return &IntSet{

View File

@ -21,7 +21,7 @@ type StrSet struct {
}
// New create and returns a new set, which contains un-repeated items.
// The parameter <safe> used to specify whether using set in concurrent-safety,
// The parameter <safe> is used to specify whether using set in concurrent-safety,
// which is false in default.
func NewStrSet(safe ...bool) *StrSet {
return &StrSet{

View File

@ -34,7 +34,7 @@ type AVLTreeNode struct {
}
// NewAVLTree instantiates an AVL tree with the custom key comparator.
// The parameter <safe> used to specify whether using tree in concurrent-safety,
// The parameter <safe> is used to specify whether using tree in concurrent-safety,
// which is false in default.
func NewAVLTree(comparator func(v1, v2 interface{}) int, safe ...bool) *AVLTree {
return &AVLTree{
@ -44,7 +44,7 @@ func NewAVLTree(comparator func(v1, v2 interface{}) int, safe ...bool) *AVLTree
}
// NewAVLTreeFrom instantiates an AVL tree with the custom key comparator and data map.
// The parameter <safe> used to specify whether using tree in concurrent-safety,
// The parameter <safe> is used to specify whether using tree in concurrent-safety,
// which is false in default.
func NewAVLTreeFrom(comparator func(v1, v2 interface{}) int, data map[interface{}]interface{}, safe ...bool) *AVLTree {
tree := NewAVLTree(comparator, safe...)

View File

@ -41,7 +41,7 @@ type BTreeEntry struct {
}
// NewBTree instantiates a B-tree with <m> (maximum number of children) and a custom key comparator.
// The parameter <safe> used to specify whether using tree in concurrent-safety,
// The parameter <safe> is used to specify whether using tree in concurrent-safety,
// which is false in default.
// Note that the <m> must be greater or equal than 3, or else it panics.
func NewBTree(m int, comparator func(v1, v2 interface{}) int, safe ...bool) *BTree {
@ -56,7 +56,7 @@ func NewBTree(m int, comparator func(v1, v2 interface{}) int, safe ...bool) *BTr
}
// NewBTreeFrom instantiates a B-tree with <m> (maximum number of children), a custom key comparator and data map.
// The parameter <safe> used to specify whether using tree in concurrent-safety,
// The parameter <safe> is used to specify whether using tree in concurrent-safety,
// which is false in default.
func NewBTreeFrom(m int, comparator func(v1, v2 interface{}) int, data map[interface{}]interface{}, safe ...bool) *BTree {
tree := NewBTree(m, comparator, safe...)

View File

@ -41,7 +41,7 @@ type RedBlackTreeNode struct {
}
// NewRedBlackTree instantiates a red-black tree with the custom key comparator.
// The parameter <safe> used to specify whether using tree in concurrent-safety,
// The parameter <safe> is used to specify whether using tree in concurrent-safety,
// which is false in default.
func NewRedBlackTree(comparator func(v1, v2 interface{}) int, safe ...bool) *RedBlackTree {
return &RedBlackTree{
@ -51,7 +51,7 @@ func NewRedBlackTree(comparator func(v1, v2 interface{}) int, safe ...bool) *Red
}
// NewRedBlackTreeFrom instantiates a red-black tree with the custom key comparator and <data> map.
// The parameter <safe> used to specify whether using tree in concurrent-safety,
// The parameter <safe> is used to specify whether using tree in concurrent-safety,
// which is false in default.
func NewRedBlackTreeFrom(comparator func(v1, v2 interface{}) int, data map[interface{}]interface{}, safe ...bool) *RedBlackTree {
tree := NewRedBlackTree(comparator, safe...)