0

I have CSV string like HK1, Hk2, Hk3......, SG1, SG2 & so on. depending on size of list I need to call REST call to back end system but problem is that, back end system wants multiple calls if String is too long, like if String have 8 values then divide in 2 calls.

So we decided to use flatMap in play framework, our problem is that string is dyanmic some time it have 10 values sometime 20 sometime 25, in this case how to use flatMap.

I can devide the list in multiple of 4 but how we need to call flatMap dynamically so that all sublist cover.

Michael Zajac
  • 55,144
  • 7
  • 113
  • 138
GLADIATOR
  • 119
  • 1
  • 12
  • So, what's the problem ? This is how flatmap works. – ffarquet Dec 02 '14 at 08:12
  • If I have 20 values I will divide into 4 promises like p1.flatmap().flatMap().flatMap() but in our case we are not sure how long string is? So dynamically how to use flatMap – GLADIATOR Dec 02 '14 at 08:19
  • What is it that you're mapping? What is the type of `p1`, etc? Some sample code would help solve your problem. – Michael Zajac Dec 03 '14 at 18:42

0 Answers0