Skip to content

Commit 9576898

Browse files
mp911dechristophstrobl
authored andcommitted
DATAREDIS-645 - Polishing.
Migrate LettuceReactiveStringCommandsTests to StepVerifier and replace Collection.stream().toArray(…) with Collection.toArray(…). Original Pull Request: spring-projects#249
1 parent d6ea867 commit 9576898

File tree

3 files changed

+130
-89
lines changed

3 files changed

+130
-89
lines changed

src/main/java/org/springframework/data/redis/connection/ReactiveStringCommands.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ default Mono<Boolean> set(ByteBuffer key, ByteBuffer value, Expiration expiratio
192192
* Get single element stored at {@literal key}.
193193
*
194194
* @param key must not be {@literal null}.
195-
* @return empty {@link ByteBuffer} in case {@literal key} does not exist.
195+
* @return {@link Mono#empty()} in case {@literal key} does not exist.
196196
* @see <a href="http://redis.io/commands/get">Redis Documentation: GET</a>
197197
*/
198198
default Mono<ByteBuffer> get(ByteBuffer key) {
@@ -218,7 +218,7 @@ default Mono<ByteBuffer> get(ByteBuffer key) {
218218
*
219219
* @param key must not be {@literal null}.
220220
* @param value must not be {@literal null}.
221-
* @return
221+
* @return {@link Mono#empty()} if key did not exist.
222222
* @see <a href="http://redis.io/commands/getset">Redis Documentation: GETSET</a>
223223
*/
224224
default Mono<ByteBuffer> getSet(ByteBuffer key, ByteBuffer value) {

src/main/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveStringCommands.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public Flux<MultiValueResponse<List<ByteBuffer>, ByteBuffer>> mGet(Publisher<Lis
6767

6868
Assert.notNull(keys, "Keys must not be null!");
6969

70-
return cmd.mget(keys.stream().toArray(ByteBuffer[]::new)).map((value) -> value.getValueOrElse(EMPTY_BYTE_BUFFER))
70+
return cmd.mget(keys.toArray(new ByteBuffer[0])).map((value) -> value.getValueOrElse(EMPTY_BYTE_BUFFER))
7171
.collectList().map((values) -> new MultiValueResponse<>(keys, values));
7272
}));
7373
}
@@ -337,7 +337,7 @@ public Flux<NumericResponse<BitOpCommand, Long>> bitOp(Publisher<BitOpCommand> c
337337

338338
Mono<Long> result = null;
339339
ByteBuffer destinationKey = command.getDestinationKey();
340-
ByteBuffer[] sourceKeys = command.getKeys().stream().toArray(ByteBuffer[]::new);
340+
ByteBuffer[] sourceKeys = command.getKeys().toArray(new ByteBuffer[0]);
341341

342342
switch (command.getBitOp()) {
343343
case AND:
@@ -369,6 +369,7 @@ public Flux<NumericResponse<BitOpCommand, Long>> bitOp(Publisher<BitOpCommand> c
369369
*/
370370
@Override
371371
public Flux<NumericResponse<KeyCommand, Long>> strLen(Publisher<KeyCommand> commands) {
372+
372373
return connection.execute(cmd -> {
373374

374375
return Flux.from(commands).flatMap(command -> {

0 commit comments

Comments
 (0)