Overload getAllSortedFiatCurrencies() with Comparator param

The default method sorts by currency name, in come cases we need to
sort by currency code, e.g., swift accounts.  This method allows
sorting by either.
This commit is contained in:
ghubstan 2021-11-22 11:54:12 -03:00
parent e50cd42478
commit a113b3ddfb
No known key found for this signature in database
GPG key ID: E35592D6800A861E

View file

@ -82,7 +82,13 @@ public class CurrencyUtil {
}
public static Collection<FiatCurrency> getAllSortedFiatCurrencies() {
return fiatCurrencyMapSupplier.get().values();
return fiatCurrencyMapSupplier.get().values(); // sorted by currency name
}
public static Collection<FiatCurrency> getAllSortedFiatCurrencies(Comparator comparator) {
return (List<FiatCurrency>) getAllSortedFiatCurrencies().stream()
.sorted(comparator) // sorted by comparator param
.collect(Collectors.toList());
}
private static Map<String, FiatCurrency> createFiatCurrencyMap() {