Skip to content

Commit

Permalink
add argument 'capacity~' for @hashset.new
Browse files Browse the repository at this point in the history
  • Loading branch information
myfreess authored and bobzhang committed Jan 14, 2025
1 parent 639ffb2 commit 19ebaa5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions hashset/hashset.mbt
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ let default_init_capacity = 8

///|
/// Create new hash set.
pub fn T::new[K]() -> T[K] {
pub fn T::new[K](capacity~ : Int = default_init_capacity) -> T[K] {
{
size: 0,
capacity: default_init_capacity,
capacity,
growAt: calc_grow_threshold(default_init_capacity),
entries: FixedArray::make(default_init_capacity, None),
}
Expand Down
2 changes: 1 addition & 1 deletion hashset/hashset.mbti
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ impl T {
intersection[K : Hash + Eq](Self[K], Self[K]) -> Self[K]
is_empty[K](Self[K]) -> Bool
iter[K](Self[K]) -> Iter[K]
new[K]() -> Self[K]
new[K](capacity~ : Int = ..) -> Self[K]
of[K : Hash + Eq](FixedArray[K]) -> Self[K]
remove[K : Hash + Eq](Self[K], K) -> Unit
size[K](Self[K]) -> Int
Expand Down

0 comments on commit 19ebaa5

Please sign in to comment.