Single<Long> createTag(String tag) {
// creating tag, returning long id
}
Single<List<Long>> createTags(List<String> tags) {
return Observable.fromIterable(tags)
.flatMap(this::createTag)
.toList();
}
Completable attachTagsToUser(List<String> tags, User user) {
return createTags(tags)
.flatMapCompletable(tagIds -> /* do what you want, here the ids */);
}