Hi,
I think the method is incorrect.
It should not use Coord.equal() to check if first and last point is equal, instead
it should test if the points are identical.
Sample where the current implementation fails:
http://www.openstreetmap.org/way/59994654
The way has a closed loop, but first and last point are not identical because
the way starts with a short segment that is not part of the loop.
Gerd