From f62134af0d6f647e6241e5496bc83571b90949de Mon Sep 17 00:00:00 2001 From: Claus Stadler Date: Mon, 13 Nov 2023 17:05:26 +0100 Subject: [PATCH] Added toMap() method to MapPaginator --- .../org/aksw/commons/rx/lookup/MapPaginator.java | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/aksw-commons-rx/src/main/java/org/aksw/commons/rx/lookup/MapPaginator.java b/aksw-commons-rx/src/main/java/org/aksw/commons/rx/lookup/MapPaginator.java index 0b15f12b..0b75157a 100644 --- a/aksw-commons-rx/src/main/java/org/aksw/commons/rx/lookup/MapPaginator.java +++ b/aksw-commons-rx/src/main/java/org/aksw/commons/rx/lookup/MapPaginator.java @@ -7,6 +7,8 @@ import com.google.common.collect.Range; +import io.reactivex.rxjava3.core.Single; + /** * I think the ListService interface should be changed to: * ListService.createPaginator(Concept) @@ -23,10 +25,18 @@ default Map fetchMap() { return fetchMap(RangeUtils.rangeStartingWithZero); } + default Single> toMap() { + Single> result = toMap(RangeUtils.rangeStartingWithZero); + return result; + } + + default Single> toMap(Range range) { + Single> result = apply(range).toMap(Entry::getKey, Entry::getValue); + return result; + } + default Map fetchMap(Range range) { - Map result = apply(range) - .toMap(Entry::getKey, Entry::getValue) - .blockingGet(); + Map result = toMap(range).blockingGet(); // .collect(Collectors.toMap( // Entry::getKey, // Entry::getValue,