I didn\'t even know this was doable, but I saw while perusing some code online a method with a signature like this:
public List read( ... )
>
One case in which it may be useful is if you wanted to return a collection of return values from a function. Say
static List forEach(Func func, List items) {
List ret = new List();
for(int i = 0; i< items.length; i++) {
ret.add(func.call(items[i]);
}
return ret;
}
public static void main() {
...
List boringResult =
forEach(
new Func {@override Void call(Integer i) {...}});
}
Not that useful but you could see a case where it was required.