August 2017
Intermediate to advanced
440 pages
10h
English
Sometimes we need to call a function and provide only selected arguments. In Java, we could create multiple overloads of the same method, but this solution has some limitations. The first problem is that the number of possible permutations of a given method is growing very quickly (2n), making them very difficult to maintain. The second problem is that overloads must be distinguishable from each other, so the compiler may know which overload to call. So when a method defines a few parameters with the same type, we can't define all possible overloads. That's why in Java we often need to pass multiple null values to a method:
// Java
printValue("abc", null, null, "!");
Multiple null parameters provide ...
Read now
Unlock full access