left fold java

Solutions on MaxInterview for left fold java by the best coders in the world

showing results for - "left fold java"
Valentina
14 May 2018
1# https://apocalisp.wordpress.com/2008/04/22/left-fold-in-java/
2# now that there is lambdas in Java it's certainly easier but
3# this one should stay with us for it is beautiful!
4  
5  public static <A, B> A fold(F<A, F<B, A>> f, A z, Iterable<B> xs)
6    { A p = z;
7      for (B x : xs)
8        { p = f.f(p).f(x); }
9      return p; }
queries leading to this page
left fold javajava fold leftleft fold java