addDeduplicate method

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

Adds the content of another DatastoreBundle to this one, with an option to deduplicate the elements.

If deduplicate is true, this method will check for duplicates before adding elements, which is more expensive.

Implementation

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