/
aizner
/
hash
Обзор
Документация
Войти
/
aizner
/
hash
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
Addres.java
37 строк
856 B
aizner
Addres.java
26 янв 2026, 19:37
Верифицирован
26 янв 2026, 19:37
f0827c6
Код
Авторство
О чём код?
import java.util.Objects; public class Address { private final String country; private final String city; public Address(String country, String city) { this.country = country == null ? "" : country.trim(); this.city = city == null ? "" : city.trim(); } public String getCountry() { return country; } public String getCity() { return city; } @Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof Address)) return false; Address address = (Address) o; return country.equals(address.country) && city.equals(address.city); } @Override public int hashCode() { return Objects.hash(country, city); } @Override public String toString() { return country + ", " + city; } }