java - Function composition chain using method -
how should declare method combine can take arguments in such way:
function<list<string>,string> f1; function<string,list<integer>> f2; function<list<integer>,integer> f3; system.out.println(this.combine(f1)); system.out.println(this.combine(f1,f2)); system.out.println(this.combine(f1,f2,f3)); etc
this generic object parameter indicating type of objects contains, in above example list of string
thanks help
thanks, right. method combine should return value of last function, so:
obj obj = new obj(arrays.aslist(args)); string s = obj.combine(f1); list<integer> l = obj.combine(f1,f2); integer = obj.combine(f1,f2,f3)
you can't overload combine method
Comments
Post a Comment