public MonetaryAmountFactory getAmountFactory(MonetaryAmountFactoryQuery query) {
        Collection<MonetaryAmountFactory<?>> factories = getAmountFactories(query);
        if (factories.isEmpty()) {
            return null;
        }
        return factories.iterator().next();
    }
public MonetaryAmountFactory getAmountFactory ( MonetaryAmountFactoryQuery query ) { Collection < MonetaryAmountFactory < ? > > factories = getAmountFactories ( query ) ; if ( factories . isEmpty ( ) ) { return null ; } return factories . iterator ( ) . next ( ) ; }
Executes the query and returns the {@link javax.money.MonetaryAmountFactory} implementation type found,
if there is only one type. If multiple types match the query, the first one is selected.

@param query the factory query, not null.
@return the type found, or null.