why FunctionN(0-22) ProductN(1-22) TupleN(1-22)?
The api has FunctionN(0-22) ProductN(1-22) TupleN(1-22) the question i开发者_JAVA技巧s: 1.why the number is end of 22? why not 21 or 23? 2.why Function is start with 0 ? but Product and Tuple are not?
It does not make sense to have a Product or a Tuple that contains no elements. These would be equivalent to Unit.
Function0 exists because a function does not necessarily take arguments (e.g. in the case of by-name arguments).
In the case of Tuple22 and Function22 I cannot tell why the Scala team chose 22 as a maximum but it definitely is awkward to have tuples with that many members or functions that take more than 22 arguments.
It could be though that there is a restriction on how many arguments to a method the JVM can handle.
加载中,请稍侯......
精彩评论