DATAREDIS-613 - Polishing.

Simplify next().flatMapMany(…) to flatMap(…).

Original pull request: #244.
This commit is contained in:
Mark Paluch
2017-04-13 10:21:31 +02:00
parent 42c87e24f9
commit 31e0c39c41
5 changed files with 35 additions and 42 deletions

View File

@@ -876,8 +876,8 @@ public interface ReactiveGeoCommands {
Assert.notNull(key, "Key must not be null!");
Assert.notNull(circle, "Circle must not be null!");
return geoRadius(Mono.just(GeoRadiusCommand.within(circle).withArgs(geoRadiusArgs).forKey(key))).next()
.flatMapMany(CommandResponse::getOutput);
return geoRadius(Mono.just(GeoRadiusCommand.within(circle).withArgs(geoRadiusArgs).forKey(key)))
.flatMap(CommandResponse::getOutput);
}
/**
@@ -1203,8 +1203,8 @@ public interface ReactiveGeoCommands {
Assert.notNull(distance, "Distance must not be null!");
return geoRadiusByMember(
Mono.just(GeoRadiusByMemberCommand.within(distance).from(member).forKey(key).withArgs(geoRadiusArgs))).next()
.flatMapMany(CommandResponse::getOutput);
Mono.just(GeoRadiusByMemberCommand.within(distance).from(member).forKey(key).withArgs(geoRadiusArgs)))
.flatMap(CommandResponse::getOutput);
}
/**

View File

@@ -520,7 +520,7 @@ public interface ReactiveHashCommands {
Assert.notNull(key, "Key must not be null!");
return hKeys(Mono.just(new KeyCommand(key))).next().flatMapMany(CommandResponse::getOutput);
return hKeys(Mono.just(new KeyCommand(key))).flatMap(CommandResponse::getOutput);
}
/**
@@ -543,7 +543,7 @@ public interface ReactiveHashCommands {
Assert.notNull(key, "Key must not be null!");
return hVals(Mono.just(new KeyCommand(key))).next().flatMapMany(CommandResponse::getOutput);
return hVals(Mono.just(new KeyCommand(key))).flatMap(CommandResponse::getOutput);
}
/**
@@ -566,7 +566,7 @@ public interface ReactiveHashCommands {
Assert.notNull(key, "Key must not be null!");
return hGetAll(Mono.just(new KeyCommand(key))).next().flatMapMany(CommandResponse::getOutput);
return hGetAll(Mono.just(new KeyCommand(key))).flatMap(CommandResponse::getOutput);
}
/**

View File

@@ -272,8 +272,7 @@ public interface ReactiveListCommands {
Assert.notNull(key, "Key must not be null!");
return lRange(Mono.just(RangeCommand.key(key).fromIndex(start).toIndex(end))).next()
.flatMapMany(CommandResponse::getOutput);
return lRange(Mono.just(RangeCommand.key(key).fromIndex(start).toIndex(end))).flatMap(CommandResponse::getOutput);
}
/**

View File

@@ -528,7 +528,7 @@ public interface ReactiveSetCommands {
Assert.notNull(keys, "Keys must not be null!");
return sInter(Mono.just(SInterCommand.keys(keys))).next().flatMapMany(CommandResponse::getOutput);
return sInter(Mono.just(SInterCommand.keys(keys))).flatMap(CommandResponse::getOutput);
}
/**
@@ -672,7 +672,7 @@ public interface ReactiveSetCommands {
Assert.notNull(keys, "Keys must not be null!");
return sUnion(Mono.just(SUnionCommand.keys(keys))).next().flatMapMany(CommandResponse::getOutput);
return sUnion(Mono.just(SUnionCommand.keys(keys))).flatMap(CommandResponse::getOutput);
}
/**
@@ -816,7 +816,7 @@ public interface ReactiveSetCommands {
Assert.notNull(keys, "Keys must not be null!");
return sDiff(Mono.just(SDiffCommand.keys(keys))).next().flatMapMany(CommandResponse::getOutput);
return sDiff(Mono.just(SDiffCommand.keys(keys))).flatMap(CommandResponse::getOutput);
}
/**
@@ -917,7 +917,7 @@ public interface ReactiveSetCommands {
Assert.notNull(key, "Key must not be null!");
return sMembers(Mono.just(new KeyCommand(key))).next().flatMapMany(CommandResponse::getOutput);
return sMembers(Mono.just(new KeyCommand(key))).flatMap(CommandResponse::getOutput);
}
/**
@@ -1009,8 +1009,7 @@ public interface ReactiveSetCommands {
Assert.notNull(key, "Key must not be null!");
Assert.notNull(count, "Count must not be null!");
return sRandMember(Mono.just(SRandMembersCommand.valueCount(count).from(key))).next()
.flatMapMany(CommandResponse::getOutput);
return sRandMember(Mono.just(SRandMembersCommand.valueCount(count).from(key))).flatMap(CommandResponse::getOutput);
}
/**

View File

@@ -657,8 +657,7 @@ public interface ReactiveZSetCommands {
Assert.notNull(range, "Range must not be null!");
return zRange(Mono.just(ZRangeCommand.valuesWithin(range).from(key))) //
.next() //
.flatMapMany(CommandResponse::getOutput).map(tuple -> ByteBuffer.wrap(tuple.getValue()));
.flatMap(CommandResponse::getOutput).map(tuple -> ByteBuffer.wrap(tuple.getValue()));
}
/**
@@ -673,8 +672,8 @@ public interface ReactiveZSetCommands {
Assert.notNull(key, "Key must not be null!");
return zRange(Mono.just(ZRangeCommand.valuesWithin(range).withScores().from(key))).next()
.flatMapMany(CommandResponse::getOutput);
return zRange(Mono.just(ZRangeCommand.valuesWithin(range).withScores().from(key)))
.flatMap(CommandResponse::getOutput);
}
/**
@@ -689,8 +688,8 @@ public interface ReactiveZSetCommands {
Assert.notNull(key, "Key must not be null!");
return zRange(Mono.just(ZRangeCommand.reverseValuesWithin(range).from(key))).next()
.flatMapMany(CommandResponse::getOutput).map(tuple -> ByteBuffer.wrap(tuple.getValue()));
return zRange(Mono.just(ZRangeCommand.reverseValuesWithin(range).from(key))).flatMap(CommandResponse::getOutput)
.map(tuple -> ByteBuffer.wrap(tuple.getValue()));
}
/**
@@ -705,8 +704,8 @@ public interface ReactiveZSetCommands {
Assert.notNull(key, "Key must not be null!");
return zRange(Mono.just(ZRangeCommand.reverseValuesWithin(range).withScores().from(key))).next()
.flatMapMany(CommandResponse::getOutput);
return zRange(Mono.just(ZRangeCommand.reverseValuesWithin(range).withScores().from(key)))
.flatMap(CommandResponse::getOutput);
}
/**
@@ -848,8 +847,7 @@ public interface ReactiveZSetCommands {
Assert.notNull(range, "Range must not be null!");
return zRangeByScore(Mono.just(ZRangeByScoreCommand.scoresWithin(range).from(key))) //
.next() //
.flatMapMany(CommandResponse::getOutput) //
.flatMap(CommandResponse::getOutput) //
.map(tuple -> ByteBuffer.wrap(tuple.getValue()));
}
@@ -868,8 +866,7 @@ public interface ReactiveZSetCommands {
Assert.notNull(range, "Range must not be null!");
return zRangeByScore(Mono.just(ZRangeByScoreCommand.scoresWithin(range).from(key).limitTo(limit))) //
.next() //
.flatMapMany(CommandResponse::getOutput) //
.flatMap(CommandResponse::getOutput) //
.map(tuple -> ByteBuffer.wrap(tuple.getValue()));
}
@@ -886,8 +883,8 @@ public interface ReactiveZSetCommands {
Assert.notNull(key, "Key must not be null!");
Assert.notNull(range, "Range must not be null!");
return zRangeByScore(Mono.just(ZRangeByScoreCommand.scoresWithin(range).withScores().from(key))).next()
.flatMapMany(CommandResponse::getOutput);
return zRangeByScore(Mono.just(ZRangeByScoreCommand.scoresWithin(range).withScores().from(key)))
.flatMap(CommandResponse::getOutput);
}
/**
@@ -905,7 +902,7 @@ public interface ReactiveZSetCommands {
Assert.notNull(range, "Range must not be null!");
return zRangeByScore(Mono.just(ZRangeByScoreCommand.scoresWithin(range).withScores().from(key).limitTo(limit)))
.next().flatMapMany(CommandResponse::getOutput);
.flatMap(CommandResponse::getOutput);
}
/**
@@ -921,8 +918,7 @@ public interface ReactiveZSetCommands {
Assert.notNull(key, "Key must not be null!");
return zRangeByScore(Mono.just(ZRangeByScoreCommand.reverseScoresWithin(range).from(key))) //
.next() //
.flatMapMany(CommandResponse::getOutput) //
.flatMap(CommandResponse::getOutput) //
.map(tuple -> ByteBuffer.wrap(tuple.getValue()));
}
@@ -941,8 +937,7 @@ public interface ReactiveZSetCommands {
Assert.notNull(range, "Range must not be null!");
return zRangeByScore(Mono.just(ZRangeByScoreCommand.reverseScoresWithin(range).from(key).limitTo(limit))) //
.next() //
.flatMapMany(CommandResponse::getOutput) //
.flatMap(CommandResponse::getOutput) //
.map(tuple -> ByteBuffer.wrap(tuple.getValue()));
}
@@ -959,8 +954,8 @@ public interface ReactiveZSetCommands {
Assert.notNull(key, "Key must not be null!");
Assert.notNull(range, "Range must not be null!");
return zRangeByScore(Mono.just(ZRangeByScoreCommand.reverseScoresWithin(range).withScores().from(key))).next()
.flatMapMany(CommandResponse::getOutput);
return zRangeByScore(Mono.just(ZRangeByScoreCommand.reverseScoresWithin(range).withScores().from(key)))
.flatMap(CommandResponse::getOutput);
}
/**
@@ -978,8 +973,8 @@ public interface ReactiveZSetCommands {
Assert.notNull(range, "Range must not be null!");
return zRangeByScore(
Mono.just(ZRangeByScoreCommand.reverseScoresWithin(range).withScores().from(key).limitTo(limit))).next()
.flatMapMany(CommandResponse::getOutput);
Mono.just(ZRangeByScoreCommand.reverseScoresWithin(range).withScores().from(key).limitTo(limit)))
.flatMap(CommandResponse::getOutput);
}
/**
@@ -1736,8 +1731,8 @@ public interface ReactiveZSetCommands {
Assert.notNull(key, "Key must not be null!");
Assert.notNull(range, "Range must not be null!");
return zRangeByLex(Mono.just(ZRangeByLexCommand.stringsWithin(range).from(key).limitTo(limit))).next()
.flatMapMany(CommandResponse::getOutput);
return zRangeByLex(Mono.just(ZRangeByLexCommand.stringsWithin(range).from(key).limitTo(limit)))
.flatMap(CommandResponse::getOutput);
}
/**
@@ -1767,8 +1762,8 @@ public interface ReactiveZSetCommands {
Assert.notNull(key, "Key must not be null!");
Assert.notNull(range, "Range must not be null!");
return zRangeByLex(Mono.just(ZRangeByLexCommand.reverseStringsWithin(range).from(key).limitTo(limit))).next()
.flatMapMany(CommandResponse::getOutput);
return zRangeByLex(Mono.just(ZRangeByLexCommand.reverseStringsWithin(range).from(key).limitTo(limit)))
.flatMap(CommandResponse::getOutput);
}
/**