1.方式1: Iterator 方式,break跳出循环体

Iterator<JsonNode> it = laneDividerJson.elements();
while (it.hasNext()) {
   String geom = it.next().get(GEOM).asText();
   try {
       LineString lineStr = (LineString) READER.read(geom);
       if (lineStr.intersects(line)) {
          exist.set(true);
          break;
        }

       } catch (ParseException ex) {
          LOGGER.error(ex.toString());
       }
}

2.foreach方式

Map<String, JsonNode> boundarySMap = new HashMap<>();
jsonNode.fields().forEachRemaining(json -> {
  JsonNode boundaryJson = json.getValue();
  String fDivId = json.get("divId").asText();
  boundarySMap.put(fDivId, boundaryJson);
});