public void addCurrency Currency currency if currency getName length f

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
public void addCurrency(Currency currency) {
if (currency.getName().length() == 3 )
{
for (Currency curColl : currencyCollections) {
if (curColl.getName().equals(currency.getName())) {
curColl.setValue(currency.getValue());
System.out.println(curColl.getName() + "=" + currency.getName() + " обновлена");
return;
}
}
currencyCollections.add(currency);
System.out.println("Добавлена н новая валюта");
}
else
System.out.println("Валюта не три символа");
}