-
Notifications
You must be signed in to change notification settings - Fork 95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Task 4 #262
base: master
Are you sure you want to change the base?
Task 4 #262
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
создавай, пожалуйста, под каждое задание отдельную ветку и отдельный ПР, а то я немного запуталась, проверять ли мне задание про прогноз погоды или про дома из игры престолов. Так же как совет, осмысленно ставить пустые строки, они тоже важны и могут повлиять на читаемость кода. В целом, очень хорошая работа! Молодец! аппрув)
public String getWeatherReport(String city){ | ||
if (weatherReport.containsKey(city)){ | ||
return weatherReport.get(city).toString(); | ||
} else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
можно убрать else {, вытащить то что сейчас в этом блоке else из него, так как если поинтер зайдет в блок if и if будет true, то блок if отработает и мы выйдем из метода
if (weatherReport.containsKey(city)){ | ||
weatherReport.remove(city); | ||
return String.format(Message.CITY_DELETED, city); | ||
} else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
то же самое что и выше, не обязательно писать throw в блоке. И я бы написала throw в блоке if сделав инверсию, а остальной код без блока, вот так:
if (!weatherReport.containsKey(city)){ throw new ForecastException(String.format(Message.NO_SUCH_CITY, city)); } weatherReport.remove(city); return String.format(Message.CITY_DELETED, city);
так мы показываем при каком условии у нас может возникнуть исключительная ситуация, и что во всех остальных случаях код выполнится без проблем
String motto; | ||
String sigil; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private
No description provided.