Simplify getAsTuple
This commit is contained in:
parent
8c9348700a
commit
9f8e7dcc1a
@ -145,9 +145,7 @@ public class Nouritsu extends NanoHTTPD {
|
|||||||
|
|
||||||
// Get k1 and k2 as a tuple in Either.Right or Either.Left if k1 or k2 is/are not in the map.
|
// Get k1 and k2 as a tuple in Either.Right or Either.Left if k1 or k2 is/are not in the map.
|
||||||
private static Either<Resp, Tuple2<String, String>> getAsTuple(Map<String, String> params, String k1, String k2) {
|
private static Either<Resp, Tuple2<String, String>> getAsTuple(Map<String, String> params, String k1, String k2) {
|
||||||
return getFromParams(params, k1)
|
return zip(getFromParams(params, k1), getFromParams(params, k2));
|
||||||
.map(Tuple::of)
|
|
||||||
.flatMap(name -> getFromParams(params, k2).map(name::append));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
Loading…
Reference in New Issue
Block a user