<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">import java.util.Set;
import java.util.TreeSet;

class Osoba {
	private String imie;
	private String nazwisko;
	public Osoba(String imie, String nazwisko) {
		super();
		this.imie = imie;
		this.nazwisko = nazwisko;
	}
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((imie == null) ? 0 : imie.hashCode());
		result = prime * result
			+ ((nazwisko == null) ? 0 : nazwisko.hashCode());
		return result;
	}
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Osoba other = (Osoba) obj;
		if (imie == null) {
			if (other.imie != null)
				return false;
		} else if (!imie.equals(other.imie))
			return false;
		if (nazwisko == null) {
			if (other.nazwisko != null)
				return false;
		} else if (!nazwisko.equals(other.nazwisko))
			return false;
		return true;
	}
	@Override
	public String toString() {
		return "Osoba [imie=" + imie + ", nazwisko=" + nazwisko + "]";
	}
}

public class Zagadka2 {

	public static void main(String[] args){
		Set&lt;Osoba&gt; osoby = new TreeSet&lt;Osoba&gt;();

		osoby.add(new Osoba("Ala", "Kowalska"));
		osoby.add(new Osoba("Ola", "Nowak"));
		osoby.add(new Osoba("Ala", "Kowalska"));

		System.out.println(osoby.size());
		for(Osoba o : osoby) {
			System.out.println(o);
		}
	}
}

</pre></body></html>