Witam, mam taki oto problem, napisałem classe
import java.util.*;
public class ZbiorPunktow extends LepszyPunkt
{
HashSet<LepszyPunkt> Zbior = new HashSet<LepszyPunkt>();
public ZbiorPunktow()
{
}
public void dodaj(int x, int y)
{
Zbior.add(new LepszyPunkt(x,y));
}
}
W instrukcji main mam:
ZbiorPunktow Spis = new ZbiorPunktow();
int ile = 0;
ile = in.nextInt();
for(int i = 0; i<ile;i++)
{
x = in.nextInt();
y = in.nextInt();
Spis.dodaj(x,y);
}
Mój problem polega na tym, iż jak chcę później to wyświetlić, to w kolekcji jest TYLKO jeden element, obojętnie ile bym nie dodał i ZAWSZE jest to pierwszy który dodaje - dlaczego się tak dzieje?