Open brennanleez-coder opened 3 years ago
well written, thank you for sharing with us your knowledge! Really appreciate it ^^
can't wait to use it in the upcoming levels of the project!
thank you for clarifying!
Thanks for sharing, brennanleez-coder! With this knowledge, I can now confidently tackle Lab 6!
This issue has indeed been very insightful! Thank you brennanleez-coder for expanding my knowledge and opening my mind! I feel extremely enlightened now and more confident of tackling my Lab 6!
Just curious, does it work for other primitives like double, string objects etc?
@KevinTan1203 It actually works with any datatypes, primitives included
thank you this was very helpful!
Thanks for sharing this! I was very confused with the argument type but now I understand lab 6 better!
thanks for the insight brennanenleecoderz
well written! truly insightful piece of contribution. thank you!
Thank you so much for the explanation! You quelled all the fears I had for this module!
Thank you for the clarification!
Hi everyone, first of all shoutout to my fellow GitHubbers, jettevy, keithlimhs, gwajoon, wentinggy, hope yall are doing fine. Today my TA spoke about Var Args in the Stream.of method API and i thought i would share it with you guys.
The "..." after type T is called VarArgs if yall ever wondered and basically you can treat values as an array. VarArgs means that you can input any amount of variables, for example (int... n), you can input as many integers as you want. Taking my jshell test as an example,
it can be seen when you input (1,2,3,4,5) into the method sum, it sums all of them up. you can also input (1,2,3,4,5,6) and it will sum all of it up. As the name suggests, it can take in varying amounts of arguments.
Do also take note that any VarArgs parameter should be the last, if not it will not compile.
This is due to the method not knowing how many inputs there is for the first or second VarArgs.