int func(Collection c) { int max = int.min; void comp_max(int i) { if (i > max) max = i; } c.apply(comp_max); return max; }