private static void removeOutdatedWaypointsOfCache(@NonNull final Geocache cache, @NonNull final Collection<String> remainingWaypointIds) {
        final String idList = StringUtils.join(remainingWaypointIds, ',');
        database.delete(dbTableWaypoints, "geocode = ? AND _id NOT IN (" + idList + ")", new String[]{cache.getGeocode()});
    }
remove all waypoints of the given cache, where the id is not in the given list

@param remainingWaypointIds ids of waypoints which shall not be deleted
main/src/main/java/cgeo/geocaching/storage/DataStore.java