Add alternative to values
for enums that return immutable indexed sequence without defensive copying
#17838
bjornregnell
started this conversation in
Feature Requests
Replies: 0 comments 1 reply
-
See also gitter conversation here: https://gitter.im/scala/contributors?at=60f5bcd9049a0c3e5380f64d |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
The method
values
on enums returns anArray
that gets allocated at each call. This is inline with how Java enums work.It would be nice if an alternative method existed, for example called
seq
, that returned anArraySeq
that is just a shared immutable reference to the already allocated sequence of values, not requiring a defensive copying. This would be more efficient and also more Scala-idomatic.Beta Was this translation helpful? Give feedback.
All reactions