Skip to content

Commit

Permalink
Improve NewMapPresized/NewMapOfPresized godoc
Browse files Browse the repository at this point in the history
  • Loading branch information
puzpuzpuz committed Feb 25, 2024
1 parent cdaca8b commit 71d95c9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 4 additions & 1 deletion map.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,10 @@ func NewMap() *Map {
}

// NewMapPresized creates a new Map instance with capacity enough to hold
// sizeHint entries. If sizeHint is zero or negative, the value is ignored.
// sizeHint entries. The capacity is treated as the minimal capacity
// meaning that the underlying hash table will never shrink to
// a smaller capacity. If sizeHint is zero or negative, the value
// is ignored.
func NewMapPresized(sizeHint int) *Map {
m := &Map{}
m.resizeCond = *sync.NewCond(&m.resizeMu)
Expand Down
4 changes: 3 additions & 1 deletion mapof.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ func NewMapOf[K comparable, V any]() *MapOf[K, V] {
}

// NewMapOfPresized creates a new MapOf instance with capacity enough
// to hold sizeHint entries. If sizeHint is zero or negative, the value
// to hold sizeHint entries. The capacity is treated as the minimal capacity
// meaning that the underlying hash table will never shrink to
// a smaller capacity. If sizeHint is zero or negative, the value
// is ignored.
func NewMapOfPresized[K comparable, V any](sizeHint int) *MapOf[K, V] {
return newMapOfPresized[K, V](makeHasher[K](), sizeHint)
Expand Down

0 comments on commit 71d95c9

Please sign in to comment.