Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Expose HashSet<T> ctors with capacity in netcoreapp1.1#12600

Merged
jkotas merged 3 commits intodotnet:masterfrom
justinvp:hashset_capacity
Oct 13, 2016
Merged

Expose HashSet<T> ctors with capacity in netcoreapp1.1#12600
jkotas merged 3 commits intodotnet:masterfrom
justinvp:hashset_capacity

Conversation

@justinvp
Copy link
Copy Markdown
Contributor

Port #2862 from Future to Master.

I cherry-picked the two relevant commits from the future branch:

I then added a third commit that cleaned some things up, exposed the APIs in netcoreapp1.1, and added tests.

cc: @stephentoub, @MarkusSintonen

MarkusSintonen and others added 3 commits October 12, 2016 14:23
Adds ctors to HashSet that accept a capacity.

New tests are not included due to System.Collections.dll being
a partial facade, and the repo not currently having the infrastructure
to enable adding tests for new surface area in partial facades.
@justinvp
Copy link
Copy Markdown
Contributor Author

Part of #2869

Assert.Throws<ArgumentOutOfRangeException>("capacity", () => new HashSet<T>(-1, comparer));
Assert.Throws<ArgumentOutOfRangeException>("capacity", () => new HashSet<T>(int.MinValue, comparer));
}
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a test that adds to the HashSet up to and beyond the specified capacity?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I'll add one soon.

Copy link
Copy Markdown
Member

@stephentoub stephentoub left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for porting it over.

Copy link
Copy Markdown
Contributor

@Priya91 Priya91 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jkotas jkotas merged commit edc03bd into dotnet:master Oct 13, 2016
@justinvp justinvp deleted the hashset_capacity branch October 13, 2016 01:44
@karelz karelz modified the milestone: 1.2.0 Dec 3, 2016
picenka21 pushed a commit to picenka21/runtime that referenced this pull request Feb 18, 2022
Expose HashSet<T> ctors with capacity in netcoreapp1.1

Commit migrated from dotnet/corefx@edc03bd
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants