|
17 | 17 | package net.dv8tion.jda.core.requests.restaction.pagination;
|
18 | 18 |
|
19 | 19 | import net.dv8tion.jda.core.JDA;
|
20 |
| -import net.dv8tion.jda.core.requests.Request; |
21 |
| -import net.dv8tion.jda.core.requests.Response; |
22 |
| -import net.dv8tion.jda.core.requests.RestAction; |
23 |
| -import net.dv8tion.jda.core.requests.Route; |
| 20 | +import net.dv8tion.jda.core.requests.*; |
24 | 21 | import net.dv8tion.jda.core.utils.Checks;
|
25 | 22 | import net.dv8tion.jda.core.utils.Procedure;
|
| 23 | +import net.dv8tion.jda.core.utils.Promise; |
26 | 24 |
|
27 | 25 | import javax.annotation.Nonnull;
|
28 | 26 | import java.util.*;
|
29 | 27 | import java.util.concurrent.CompletableFuture;
|
30 | 28 | import java.util.concurrent.CopyOnWriteArrayList;
|
31 |
| -import java.util.concurrent.Future; |
32 | 29 | import java.util.concurrent.atomic.AtomicInteger;
|
33 | 30 | import java.util.function.BooleanSupplier;
|
34 | 31 | import java.util.function.Consumer;
|
@@ -364,7 +361,7 @@ public PaginationIterator iterator()
|
364 | 361 | *
|
365 | 362 | * @return {@link java.util.concurrent.Future Future} that can be cancelled to stop iteration from outside!
|
366 | 363 | */
|
367 |
| - public Future<?> forEachAsync(final Procedure<T> action) |
| 364 | + public RequestFuture<?> forEachAsync(final Procedure<T> action) |
368 | 365 | {
|
369 | 366 | return forEachAsync(action, (throwable) ->
|
370 | 367 | {
|
@@ -410,12 +407,12 @@ public Future<?> forEachAsync(final Procedure<T> action)
|
410 | 407 | *
|
411 | 408 | * @return {@link java.util.concurrent.Future Future} that can be cancelled to stop iteration from outside!
|
412 | 409 | */
|
413 |
| - public Future<?> forEachAsync(final Procedure<T> action, final Consumer<Throwable> failure) |
| 410 | + public RequestFuture<?> forEachAsync(final Procedure<T> action, final Consumer<Throwable> failure) |
414 | 411 | {
|
415 | 412 | Checks.notNull(action, "Procedure");
|
416 | 413 | Checks.notNull(failure, "Failure Consumer");
|
417 | 414 |
|
418 |
| - final CompletableFuture<?> task = new CompletableFuture<>(); |
| 415 | + final Promise<?> task = new Promise<>(); |
419 | 416 | final Consumer<List<T>> acceptor = new ChainedConsumer(task, action, (throwable) ->
|
420 | 417 | {
|
421 | 418 | task.completeExceptionally(throwable);
|
@@ -468,7 +465,7 @@ public Future<?> forEachAsync(final Procedure<T> action, final Consumer<Throwabl
|
468 | 465 | *
|
469 | 466 | * @return {@link java.util.concurrent.Future Future} that can be cancelled to stop iteration from outside!
|
470 | 467 | */
|
471 |
| - public Future<?> forEachRemainingAsync(final Procedure<T> action) |
| 468 | + public RequestFuture<?> forEachRemainingAsync(final Procedure<T> action) |
472 | 469 | {
|
473 | 470 | return forEachRemainingAsync(action, (throwable) ->
|
474 | 471 | {
|
@@ -514,12 +511,12 @@ public Future<?> forEachRemainingAsync(final Procedure<T> action)
|
514 | 511 | *
|
515 | 512 | * @return {@link java.util.concurrent.Future Future} that can be cancelled to stop iteration from outside!
|
516 | 513 | */
|
517 |
| - public Future<?> forEachRemainingAsync(final Procedure<T> action, final Consumer<Throwable> failure) |
| 514 | + public RequestFuture<?> forEachRemainingAsync(final Procedure<T> action, final Consumer<Throwable> failure) |
518 | 515 | {
|
519 | 516 | Checks.notNull(action, "Procedure");
|
520 | 517 | Checks.notNull(failure, "Failure Consumer");
|
521 | 518 |
|
522 |
| - final CompletableFuture<?> task = new CompletableFuture<>(); |
| 519 | + final Promise<?> task = new Promise<>(); |
523 | 520 | final Consumer<List<T>> acceptor = new ChainedConsumer(task, action, (throwable) ->
|
524 | 521 | {
|
525 | 522 | task.completeExceptionally(throwable);
|
|
0 commit comments