Join Slack
Powered by
can I safely increase an array in this way, withou...
# announcements
e
elect
02/28/2020, 10:45 PM
can I safely increase an array in this way, without an intermediary temporary variable?
Copy code
ptrId = Array(newBufLength) { i -> ptrId.getOrElse(i) { i } }
d
Dominaezzz
02/28/2020, 10:50 PM
Safely? It shouldn't throw if that's what you're asking. There are dedicated functions for this iirc.
copyOf
.
e
elect
02/28/2020, 11:04 PM
I mean, can I assign directly to
ptrId
by reading it in the init fun?
d
Dominaezzz
02/29/2020, 12:33 AM
Oh. Yes, the right side is evaluated before the assignment.
2
Views
Open in Slack
Previous
Next