bisq/desktop
Steven Barclay b417e36a28
Make TradeStatistics3 comparable & hold in a TreeSet
Make TradeStatistics3 implement the previously added ComparableExt
interface and make TradeStatisticsManager hold them as a TreeSet instead
of a HashSet, to support fast retrieval of statistics in any given date
range. (Even though red-black trees are generally slower than hash
tables, this should not matter here since the set is only being iterated
over and infrequently appended, and does not benefit from O(1) lookups/
additions/removals.)

Add a 'TradeStatisticsManager.getNavigableTradeStatisticsSet' accessor,
which returns the backing TreeSet of the current ObservableSet field, so
that callers can access its NavigableSet interface where needed (as
there is no ObservableSortedSet or similar in JavaFX). Use this to
optimise 'AveragePriceUtil.getAveragePriceTuple',
'DisputeAgentSelection.getLeastUsedDisputeAgent' and
'MutableOfferDataModel.getSuggestedSecurityDeposit', to obtain a narrow
date range of trade statistics without streaming over the entire set.

Additionally optimise & simplify the price collation in
'TradeStatisticsManager.onAllServicesInitialised', by exploiting the
fact that the statistics are now sorted in order of date (which is the
presently defined natural order).
2023-05-10 19:41:20 +01:00
..
package Revert to SNAPSHOT version 2023-04-15 11:59:46 +10:00
src Make TradeStatistics3 comparable & hold in a TreeSet 2023-05-10 19:41:20 +01:00
build.gradle Gradle: Apply bisq.java-conventions to all projects 2023-02-05 22:02:13 +01:00