Open
Conversation
Signed-off-by: cui fliter <imcusg@gmail.com>
Contributor
|
This PR (HEAD: 33ca1be) has been imported to Gerrit for code review. Please visit https://go-review.googlesource.com/c/exp/+/471277 to see it. Tip: You can toggle comments from me using the |
alexandear
reviewed
Mar 6, 2023
| if s2len == 0 { | ||
| return s1 | ||
| } | ||
| s2Map := make(map[E]bool, s2len) |
There was a problem hiding this comment.
Maybe we should use map[E]struct{}?
Suggested change
| s2Map := make(map[E]bool, s2len) | |
| s2Map := make(map[E]struct{}, s2len) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
There are many scenarios where it is necessary to obtain the difference of two slices. At present, the more common method is to create a new utils package in the project and write the method implementation in it. Now that the Go standard library has a new slices package, it is recommended to add an API:
Update golang/go#58730