Left fold java

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
public static <a, b=""> A fold(F<a, f<b,="" a="">> f, A z, Iterable<b> xs)
{
A p = z;
for (B x : xs)
{
p = f.f(p).f(x);
}
return p;
}
</b></a,></a,>
public static <a, b=""> A fold(F<a, f<b,="" a="">> f, A z, Iterable<b> xs) { A p = z; for (B x : xs) { p = f.f(p).f(x); } return p; } </b></a,></a,>
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; 
    }