0

I'm creating an arrayList of tasks that I want to return out of a method, which will be passed to another method that contains Tasks.whenAllSuccess(). I know that it supports multiple tasks as arguments, but it doesn't seem to want an arrayList.

Tasks.whenAllSuccess(task1, task2) //this works
Tasks.whenAllSuccess(arrayList) //this does not

Is there any way to pack multiple tasks into a list and pass it as an argument?

Any help would be greatly appreciated.

Thanks!

Doug Stevenson
  • 297,357
  • 32
  • 422
  • 441
Brian Begun
  • 509
  • 7
  • 24

1 Answers1

0

I found the solution!

Tasks.whenAllSuccess(taskArrayList.toArray(new Task[taskArrayList.size()]))

This will unpack the ArrayList and will allow Tasks to get each task from the list.

The solution came from this post: [https://stackoverflow.com/a/17837497/6846268]

Brian Begun
  • 509
  • 7
  • 24