-
Notifications
You must be signed in to change notification settings - Fork 6.2k
KT-20357: Add sample usages for array constructor functions #5521
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
KT-20357: Add sample usages for array constructor functions #5521
Conversation
|
Hi, just checking if I need to do anything else to move this toward review |
| /** | ||
| * Returns an array containing the specified [Double] numbers. | ||
| * | ||
| * @sample samples.collections.Arrays.Constructors.doubleArrayOf |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please update corresponding actual declarations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did it in a74af86
Let me know if that's what you wanted
…rd library Related issue: KT-20357
…tions in standard library Related issue: KT-20357
0713c9e to
bbe6420
Compare
Related issue: KT-20357
bbe6420 to
b49f96e
Compare
| val byteArray = arrayOf(1, 2, 3) | ||
| assertPrints(byteArray.contentToString(), "[1, 2, 3]") | ||
|
|
||
| val booleanArray = arrayOf(true, false, true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@oscarArismendi, could you please elaborate why it's necessary to showcase creation of an array for every boxed primitive type?
In some way, it could be misleading as it gives an impression that arrayOf(true, false, true) and booleanArrayOf(true, false, true) are equivalent, but they are not.
Perhaps, something like val strings = arrayOf("Hello", "world") would be enough.
But it might be worth also adding a sample like val numbers: Array<Number> = arrayOf(3.14, 42L, 0.123f)
Added a sample function for constructors in
Library.kt.These are just the basics, but I remember when I was learning Kotlin that having examples for everything would’ve made me spend more time in the official documentation.
Related issue: KT-20357