Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/hash.cr
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,8 @@ class Hash(K, V)
# The *initial_capacity* is useful to avoid unnecessary reallocations
# of the internal buffer in case of growth. If the number of elements
# a hash will hold is known, the hash should be initialized with that
# capacity for improved performance. Otherwise, the default is 11 and inputs
# less than 11 are ignored.
# capacity for improved performance. Otherwise, the default is 8.
# Inputs lower than 8 are ignored.
def initialize(block : (Hash(K, V), K -> V)? = nil, *, initial_capacity = nil)
initial_capacity = (initial_capacity || 0).to_i32

Expand Down Expand Up @@ -280,8 +280,8 @@ class Hash(K, V)
# The *initial_capacity* is useful to avoid unnecessary reallocations
# of the internal buffer in case of growth. If the number of elements
# a hash will hold is known, the hash should be initialized with that
# capacity for improved performance. Otherwise, the default is 11 and inputs
# less than 11 are ignored.
# capacity for improved performance. Otherwise, the default is 8.
# Inputs lower than 8 are ignored.
def self.new(initial_capacity = nil, &block : (Hash(K, V), K -> V))
new block, initial_capacity: initial_capacity
end
Expand All @@ -305,8 +305,8 @@ class Hash(K, V)
# The *initial_capacity* is useful to avoid unnecessary reallocations
# of the internal buffer in case of growth. If the number of elements
# a hash will hold is known, the hash should be initialized with that
# capacity for improved performance. Otherwise, the default is 11 and inputs
# less than 11 are ignored.
# capacity for improved performance. Otherwise, the default is 8.
# Inputs lower than 8 are ignored.
def self.new(default_value : V, initial_capacity = nil)
new(initial_capacity: initial_capacity) { default_value }
end
Expand Down