📜  左折叠java代码示例

📅  最后修改于: 2022-03-11 14:52:30.193000             🧑  作者: Mango

代码示例1
# https://apocalisp.wordpress.com/2008/04/22/left-fold-in-java/
# now that there is lambdas in Java it's certainly easier but
# this one should stay with us for it is beautiful!
  
  public static  A fold(F> f, A z, Iterable xs)
    { A p = z;
      for (B x : xs)
        { p = f.f(p).f(x); }
      return p; }