public boolean isHole() {
      int containedCounter = 0;
      for (Ring ring = this; ring != null; ring = ring.containedBy) {
        containedCounter++;
      }
      return containedCounter % 2 == 0;
    }
Returns true if this is an outermost ring and alternate false/true as you work inwards.
planetiler-core/src/main/java/com/onthegomap/planetiler/reader/osm/OsmMultipolygon.java