addDeduplicate method

void addDeduplicate(
  1. DatastoreReadResult other,
  2. bool deduplicate
)

Adds other MapReadResult by combining pois and ways. Optionally, deduplication can be requested (much more expensive).

@param other the MapReadResult to add to this. @param deduplicate true if check for duplicates is required.

Implementation

void addDeduplicate(DatastoreReadResult other, bool deduplicate) {
  if (deduplicate) {
    for (PointOfInterest poi in other.pointOfInterests) {
      if (!this.pointOfInterests.contains(poi)) {
        this.pointOfInterests.add(poi);
      }
    }
    for (Way way in other.ways) {
      if (!this.ways.contains(way)) {
        this.ways.add(way);
      }
    }
  } else {
    this.pointOfInterests.addAll(other.pointOfInterests);
    this.ways.addAll(other.ways);
  }
}