Skip to content

Commit

Permalink
Added toMap() method to MapPaginator
Browse files Browse the repository at this point in the history
  • Loading branch information
Aklakan committed Nov 13, 2023
1 parent 3b4daec commit f62134a
Showing 1 changed file with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -23,10 +25,18 @@ default Map<K, V> fetchMap() {
return fetchMap(RangeUtils.rangeStartingWithZero);
}

default Single<Map<K, V>> toMap() {
Single<Map<K, V>> result = toMap(RangeUtils.rangeStartingWithZero);
return result;
}

default Single<Map<K, V>> toMap(Range<Long> range) {
Single<Map<K, V>> result = apply(range).toMap(Entry::getKey, Entry::getValue);
return result;
}

default Map<K, V> fetchMap(Range<Long> range) {
Map<K, V> result = apply(range)
.toMap(Entry::getKey, Entry::getValue)
.blockingGet();
Map<K, V> result = toMap(range).blockingGet();
// .collect(Collectors.toMap(
// Entry::getKey,
// Entry::getValue,
Expand Down

0 comments on commit f62134a

Please sign in to comment.