My IDE is giving me duplicate code warning and now I'm trying to find out is there any way to unify or find common abstraction for such two methods, that are quite similar in their structure, but do the opposite things? I couldn't figure out it myself. Thx

```
public double getLowestCurrencyRateInTheCurrentMonth(String baseCurrency, String targetCurrency) {
    Map<String, Map<String, Double>> rates = getAllRatesInCurrentMonth(baseCurrency);
    double lowestRate = Double.MAX_VALUE;
    for(Map<String, Double> ratesByDate : rates.values()){
        double baseCurrecyRateToTargetCurrency = ratesByDate.get(targetCurrency);
        if(baseCurrecyRateToTargetCurrency < lowestRate){
            lowestRate = baseCurrecyRateToTargetCurrency;
        }
    }
    return lowestRate;
}

public double getHighestCurrencyRateInTheCurrentMonth(String baseCurrency, String targetCurrency) {
    Map<String, Map<String, Double>> rates = getAllRatesInCurrentMonth(baseCurrency);
    double highestRate = Double.MIN_VALUE;
    for(Map<String, Double> ratesByDate : rates.values()){
        double baseCurrecyRateToTargetCurrency = ratesByDate.get(targetCurrency);
        if(baseCurrecyRateToTargetCurrency > highestRate){
            highestRate = baseCurrecyRateToTargetCurrency;
        }
    }
    return highestRate;
}

```