for (int i = 1; i < numberOfColorClasses; i++) {
if (value <= min + (i classSize)) {
return colorPalette[i];
} else if (value > (classSize i) && i == numberOfColorClasses - 1) {
return colorPalette.last;
}
}
to this:
for (int i = 1; i < numberOfColorClasses; i++) {
if (value <= min + (i classSize)) {
return colorPalette[i];
} else if (value > min + (classSize i) &&
i == numberOfColorClasses - 1) {
return colorPalette.last;
}
}
I think this makes more sense. I think what you are trying to do is that if in the last iteration still nothing is returned, then you just return the last value. Probably you also just write ¨else if (i == numberOfColorClasses - 1) ¨ because the first condition must be true anyway, in case the previous IF does not catch
I have changed this:
for (int i = 1; i < numberOfColorClasses; i++) { if (value <= min + (i classSize)) { return colorPalette[i]; } else if (value > (classSize i) && i == numberOfColorClasses - 1) { return colorPalette.last; } }
to this:
for (int i = 1; i < numberOfColorClasses; i++) { if (value <= min + (i classSize)) { return colorPalette[i]; } else if (value > min + (classSize i) && i == numberOfColorClasses - 1) { return colorPalette.last; } }