TurfMeasurement#length method cannot handle empty lists
The other day, I encountered what I regard as an issue in the following Code snippet: https://github.com/mapbox/mapbox-java/blob/4ae8b78746fb37b2673364bdd4c8702057f3e7f3/services-turf/src/main/java/com/mapbox/turf/TurfMeasurement.java#L227
The scenario is the following: We have a list of GPS points of which some or all are invalid which is denoted by the coordinates being (0 , 0) - which IS bad Design, but our Team cannot change this... 🙄. Thus, we filter out those points before passing it to the length method. We just encountered an IndexOutOfBoundsException when the list is empty because there is no length check on the list. I guess the fix here is relatively easy, but the question ist - what should be returned in this case. We built in a check before hand returning 0 in this particular case. Maybe even a checked exception might be a feasible idea.