In this answer, I used a java.util.List
as a parameter to an anonymous function (lambda) answer. So, my question is,
Should this import be counted to the byte total?
I know, it feels like the obvious answer should be YES - if you don't import java.util.*
, my example usage won't compile.
However, it's not that simple. I could declare the type (which we don't score) as BiConsumer<java.util.List<String>, String>
- use the full name instead of importing - and then everything would be fine and dandy. To blur the line further, say an external class has a method that takes a BiConsumer<List<String>, <String>
. Then, in my test class I could use this lambda without ever referencing the java.util
package at all!
To clarify, On scoring imported functions refers to scoring a submission of a default method, where this is still scoring a lambda. The issue here is does the import statement need to be counted in the score, as it is possible to compile the lambda without the import but only under very specific conditions.
java.util
is one of the default classpaths. I don't think this is a dupe as that question concerns scoring when submitting a built in as-is, and this is still a written function. \$\endgroup\$List
is not automatically imported, it requires a specific import statement. This is a duplicate, however, as lambdas are functions. \$\endgroup\$java.util
as default, as it does require animport
. Either way, I'm considering this solved as YES. I still don't see this as a dupe but maybe I'm missing something as well. \$\endgroup\$