RE: FlatMap Explanation

2015-09-03 Thread Zalzberg, Idan (Agoda)
Hi, Yes, I can explain 1 to 3 -> 1,2,3 2 to 3- > 2,3 3 to 3 -> 3 3 to 3 -> 3 Flat map that concatenates the results, so you get 1,2,3, 2,3, 3,3 You should get the same with any scala collection Cheers From: Ashish Soni [mailto:asoni.le...@gmail.com] Sent: Thursday, September 03, 2015 9:06 AM

Re: FlatMap Explanation

2015-09-03 Thread Ashish Soni
Thanks a lot everyone. Very Helpful. Ashish On Thu, Sep 3, 2015 at 2:19 AM, Zalzberg, Idan (Agoda) < idan.zalzb...@agoda.com> wrote: > Hi, > > Yes, I can explain > > > > 1 to 3 -> 1,2,3 > > 2 to 3- > 2,3 > > 3 to 3 -> 3 > > 3 to 3 -> 3 > > > > Flat map that concatenates the results, so you get

Re: FlatMap Explanation

2015-09-02 Thread Raghavendra Pandey
Flatmap is just like map but it flattens out the seq output of the closure... In your case, you call "to" function that is to return list... a.to(b) returns list(a,...,b) So rdd.flatMap( x => x.to(3)) will take all element and return range upto 3.. On Sep 3, 2015 7:36 AM, "Ashish Soni"