@Test public void testIsoCandidate() throws Exception { assertThat(CurrencyUtils.isoCandidateFor("XBT")).isEqualTo("XBT"); assertThat(CurrencyUtils.isoCandidateFor("BTC")).isEqualTo("XBT"); assertThat(CurrencyUtils.isoCandidateFor("RUR")).isEqualTo("RUB"); assertThat(CurrencyUtils.isoCandidateFor("USD")).isEqualTo("USD"); }
public static String isoCandidateFor(String currency) { if (!initialised) { initialise(); } Preconditions.checkNotNull(currency, "'currency' must be present"); log.trace("Searching for ISO candidate for '{}'", currency); if (isoCandidateMap.containsKey(currency)) { return currency; } for (Map.Entry<String, List<String>> entry : isoCandidateMap.entrySet()) { List<String> nonStandard = entry.getValue(); for (String nonIsoCode : nonStandard) { if (nonIsoCode.equalsIgnoreCase(currency)) { return entry.getKey(); } } } return currency; }
CurrencyUtils { public static String isoCandidateFor(String currency) { if (!initialised) { initialise(); } Preconditions.checkNotNull(currency, "'currency' must be present"); log.trace("Searching for ISO candidate for '{}'", currency); if (isoCandidateMap.containsKey(currency)) { return currency; } for (Map.Entry<String, List<String>> entry : isoCandidateMap.entrySet()) { List<String> nonStandard = entry.getValue(); for (String nonIsoCode : nonStandard) { if (nonIsoCode.equalsIgnoreCase(currency)) { return entry.getKey(); } } } return currency; } }
CurrencyUtils { public static String isoCandidateFor(String currency) { if (!initialised) { initialise(); } Preconditions.checkNotNull(currency, "'currency' must be present"); log.trace("Searching for ISO candidate for '{}'", currency); if (isoCandidateMap.containsKey(currency)) { return currency; } for (Map.Entry<String, List<String>> entry : isoCandidateMap.entrySet()) { List<String> nonStandard = entry.getValue(); for (String nonIsoCode : nonStandard) { if (nonIsoCode.equalsIgnoreCase(currency)) { return entry.getKey(); } } } return currency; }  }
CurrencyUtils { public static String isoCandidateFor(String currency) { if (!initialised) { initialise(); } Preconditions.checkNotNull(currency, "'currency' must be present"); log.trace("Searching for ISO candidate for '{}'", currency); if (isoCandidateMap.containsKey(currency)) { return currency; } for (Map.Entry<String, List<String>> entry : isoCandidateMap.entrySet()) { List<String> nonStandard = entry.getValue(); for (String nonIsoCode : nonStandard) { if (nonIsoCode.equalsIgnoreCase(currency)) { return entry.getKey(); } } } return currency; }  static String currentSymbol(); static String symbolFor(String isoCode); static String isoCandidateFor(String currency); }
CurrencyUtils { public static String isoCandidateFor(String currency) { if (!initialised) { initialise(); } Preconditions.checkNotNull(currency, "'currency' must be present"); log.trace("Searching for ISO candidate for '{}'", currency); if (isoCandidateMap.containsKey(currency)) { return currency; } for (Map.Entry<String, List<String>> entry : isoCandidateMap.entrySet()) { List<String> nonStandard = entry.getValue(); for (String nonIsoCode : nonStandard) { if (nonIsoCode.equalsIgnoreCase(currency)) { return entry.getKey(); } } } return currency; }  static String currentSymbol(); static String symbolFor(String isoCode); static String isoCandidateFor(String currency);  }