Use flatMapIterable when possible

This commit is contained in:
Andrea Cavalli 2021-07-31 18:00:53 +02:00
parent 7597e54bac
commit d411675c2b
4 changed files with 52 additions and 52 deletions

View File

@ -201,7 +201,7 @@ public class DatabaseMapDictionaryHashed<T, U, TH> implements DatabaseStageMap<T
.getAllValues(snapshot)
.map(Entry::getValue)
.map(Collections::unmodifiableSet)
.flatMap(Flux::fromIterable);
.concatMapIterable(list -> list);
}
@Override

View File

@ -1024,7 +1024,7 @@ public class LLLocalDictionary implements LLDictionary {
}
})
.subscribeOn(dbScheduler)
.flatMapMany(Flux::fromIterable)
.flatMapIterable(list -> list)
.onErrorMap(cause -> new IOException("Failed to read keys "
+ Arrays.deepToString(keyBufsWindow.toArray(ByteBuf[]::new)), cause))
.doAfterTerminate(() -> keyBufsWindow.forEach(ReferenceCounted::release));
@ -1243,7 +1243,7 @@ public class LLLocalDictionary implements LLDictionary {
}
})
.subscribeOn(dbScheduler)
.flatMapMany(Flux::fromIterable);
.concatMapIterable(list -> list);
},
entriesWindow -> {
for (Tuple2<ByteBuf, X> entry : entriesWindow) {

View File

@ -477,7 +477,7 @@ public class TestDictionaryMap {
.flatMapMany(map -> Flux
.concat(map.setAndGetPrevious(entries), map.setAndGetPrevious(entries))
.map(Map::entrySet)
.flatMap(Flux::fromIterable)
.concatMapIterable(list -> list)
.doAfterTerminate(map::release)
)
));
@ -502,7 +502,7 @@ public class TestDictionaryMap {
.flatMapMany(map -> Flux
.concat(map.set(entries).then(Mono.empty()), map.clearAndGetPrevious(), map.get(null))
.map(Map::entrySet)
.flatMap(Flux::fromIterable)
.concatMapIterable(list -> list)
.doAfterTerminate(map::release)
)
));
@ -555,7 +555,7 @@ public class TestDictionaryMap {
map.putMulti(Flux.fromIterable(entries.entrySet())).then(Mono.empty()),
map.get(null)
.map(Map::entrySet)
.flatMapMany(Flux::fromIterable)
.flatMapIterable(list -> list)
)
.doAfterTerminate(map::release)
)

View File

@ -822,7 +822,7 @@ public class TestDictionaryMapDeep {
map.setAndGetPrevious(entries)
)
.map(Map::entrySet)
.flatMap(Flux::fromIterable)
.concatMapIterable(list -> list)
.doAfterTerminate(map::release)
)
));
@ -847,7 +847,7 @@ public class TestDictionaryMapDeep {
.flatMapMany(map -> Flux
.concat(map.set(entries).then(Mono.empty()), map.clearAndGetPrevious(), map.get(null))
.map(Map::entrySet)
.flatMap(Flux::fromIterable)
.concatMapIterable(list -> list)
.doAfterTerminate(map::release)
)
));
@ -900,7 +900,7 @@ public class TestDictionaryMapDeep {
map.putMulti(Flux.fromIterable(entries.entrySet())).then(Mono.empty()),
map.get(null)
.map(Map::entrySet)
.flatMapMany(Flux::fromIterable)
.flatMapIterable(list -> list)
)
.doAfterTerminate(map::release)
)