code: public CurrencyUnit getCurrency(CurrencyQuery query) {
          Set<CurrencyUnit> currencies = getCurrencies(query);
          if (currencies.isEmpty()) {
              return null;
          }
          if (currencies.size() == 1) {
              return currencies.iterator().next();
          }
          throw new MonetaryException("Ambiguous request for CurrencyUnit: " + query + ", found: " + currencies);
      }
docs: Access a single currency by query.
  
  @param query The currency query, not null.
  @return the {@link javax.money.CurrencyUnit} found, never null.
  @throws javax.money.MonetaryException if multiple currencies match the query.