コード例 #1
0
 private int cancelAllRequests(@NotNull List<Request> list) {
   int count = 0;
   for (Request request : list) {
     count++;
     request.cancel();
   }
   list.clear();
   return count;
 }
コード例 #2
0
 private void cancelRequest(@NotNull Runnable request, @NotNull List<Request> list) {
   for (int i = list.size() - 1; i >= 0; i--) {
     Request r = list.get(i);
     if (r.getTask() == request) {
       r.cancel();
       list.remove(i);
     }
   }
 }