-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Remove offer duplicates in spread view #1506
Remove offer duplicates in spread view #1506
Conversation
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.
utACK. Great that you were able to repro this at all, @ripcurlx! You'll see I called out a couple style nits, but looks good otherwise. Feel free to merge.
@@ -90,6 +94,12 @@ protected void deactivate() { | |||
offerBookListItems.removeListener(listChangeListener); | |||
} | |||
|
|||
private static <T> Predicate<T> distinctByKey(Function<? super T, ?> keyExtractor) | |||
{ |
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.
Nit: place opening brace on same line
public void testfilterSpreadItemsForUniqueOffers() { | ||
OfferBook offerBook = mock(OfferBook.class); | ||
PriceFeedService priceFeedService = mock(PriceFeedService.class); | ||
final ObservableList<OfferBookListItem> offerBookListItems = FXCollections.observableArrayList(); |
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.
Nit: don't use final
modifier on local variables unless strictly necessary (same for line 85 below.
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.
I use it out of a habit. Does it have a disadvantage to use final everywhere by default and only not use it where necessary?
Fixes #1202.
I was only able to reproduce it in a test in the SpreadModel so I added an additional safeguard there.