0

I read several posts here about this error Exception in thread "AWT-EventQueue-0" java.lang.IndexOutOfBoundsException: Index: 0, Size: 0. I tries to check my method to see if I can fix it but non of them helps. My following method keeps showing this exception but I don't know exactly where and how to fix it:

List<DataTuple> observationMembers; // Class attribute
public DataTuple meanPoint() {
    DataTuple d = this.observationMembers.get(0).clone();
    int i = 1;
    for (; i < observationMembers.size(); i++) {
        d = observationMembers.get(i).sum(d);
    }
    newCentroid = d.divide(i);
    return newCentroid;
}

Thanks.

0 Answers0