ok, this is cleaner and easier to understand. but I am still getting an error.
Cannot invoke size() on the array type String
void serialEvent( Serial port) {
//the '.' is our end delimiter indicating the end of a complete packet
String val = trim(port.readStringUntil('.'));
//make sure our data isn't empty before continuing
if (val != null) {
String i, sonar_distance, ir_distance;
String[] rawData = val.split(",");
if(rawData.size()>=3){ //Expecting three values//error=Cannot invoke size() on the array type String[]
i = rawData[0];
sonar_distance = rawData[1];
ir_distance = rawData[2];
}