@Override
public void run() {
LinkedList<Cluster> clusterList = new LinkedList<>();
int size;
for(Star s : stars){
clusterList.addFirst(new Cluster(s));
}
size = clusterList.size();
Cluster current, toBeMerged = null;
while(size > k){
int index = (int) (Math.random() * size);
current = clusterList.remove(index);
double min = Double.MAX_VALUE;
for(Cluster c : clusterList){
double currentDist = d.get(current.getCentroid(), c.getCentroid());
if(currentDist < min){
min = currentDist;
toBeMerged = c;
}
}