-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
De-duplicate stops returned by stopsByRadius
#5366
De-duplicate stops returned by stopsByRadius
#5366
Conversation
stopsByRadius
stopsByRadius
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## dev-2.x #5366 +/- ##
=============================================
+ Coverage 66.48% 66.49% +0.01%
+ Complexity 15238 15236 -2
=============================================
Files 1787 1786 -1
Lines 69325 69271 -54
Branches 7319 7291 -28
=============================================
- Hits 46088 46064 -24
+ Misses 20758 20739 -19
+ Partials 2479 2468 -11
☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The issue mentioned is indeed resolved. Thanks!
src/test/java/org/opentripplanner/framework/lang/PredicateUtilsTest.java
Show resolved
Hide resolved
630733d
to
8d39386
Compare
Oracle discourages the use of stateful filters (https://docs.oracle.com/en/java/javase/14/docs/api/java.base/java/util/stream/package-summary.html#Statelessness), an alternative implementation could use collectors to achieve the same effect:
In this particular case, the impact is limited, so approving anyway. |
That's an excellent point which I will implement in a follow-up PR. |
Summary
@binh-dam-ibigroup has reported that there are cases where the
stopsByRadius
GraphQL query returns duplicate stops. This PR removes the duplicates.It introduces a new Util class that lets you remove duplicates from a collection even when the thing to deduplicate on is not the whole entity but a field of it.
Unit tests
Added.
Documentation
Javadoc.