Refactoring lo.IntersectBy + adding loit.IntersectBy + adding doc#739
Merged
Refactoring lo.IntersectBy + adding loit.IntersectBy + adding doc#739
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #739 +/- ##
==========================================
- Coverage 94.21% 94.04% -0.17%
==========================================
Files 18 18
Lines 2817 2838 +21
==========================================
+ Hits 2654 2669 +15
- Misses 149 152 +3
- Partials 14 17 +3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Contributor
|
LGTM! My only complaint would be the duplicated code between |
Owner
Author
|
Yes, same feeling for me. |
Contributor
|
It looks much better seen := make(map[T]bool, len(lists[len(lists)-1]))
for _, item := range lists[len(lists)-1] {
seen[item] = true
}
for i := len(lists) - 2; i > 0; i-- {
...
}
result := make(Slice, 0, len(seen))
...
return resultthan for i := len(lists) - 1; i >= 0; i-- {
if i == len(lists)-1 {
for _, item := range lists[i] {
seen[item] = true
}
continue
}
if i == 0 {
result := make(Slice, 0, len(seen))
...
return result
}
...
}
return Slice{}Or am I missing something? |
Contributor
|
Or at all seen := make(map[T]bool, len(lists[0]))
for _, item := range lists[0] {
seen[item] = true
}
for i := 1; i < len(lists) - 1; i++ {
...
}
for item := range lists[len(lists) - 1] {
...
}
return result |
This was referenced Dec 29, 2025
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.
@NathanBaulch FYI