<div dir="ltr">new ArrayList<>(Arrays.asList(theArray));<br><br>I'm not intending to be pithy - just this is one of the "known deficiencies" of the collections framework. If you look hard enough you can find some spitballing I did on how to address it in the core-libs mailing list (which would be the place to go for this sort of stuff - cc-ing).<br><br>The internal class names aren't trivial to fix either because someone somewhere has serialized a java.util.Arrays$ArrayList using ObjectOutputStream and wants to read it back out at some point. Not impossible to address, just tricky.<br><br>What is the situation where you encountered the internal class name? It could be worth it to make it more clear in whatever that debug scenario is.<br><br>---<br><br>Other than that, to contribute code to the JDK you need to sign the OCA. It will take a bit so you should get that out of the way.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Nov 18, 2022 at 11:29 AM Andreas Røsdal <<a href="mailto:andreas.rosdal@gmail.com">andreas.rosdal@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Yes, the exception comes when adding objects to the returned list. So I would like a convenient way to use Arrays to convert an array to a normal modifiable java.util.ArrayList, instead of this <span><span></span>AbstractList.</span></div><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Nov 18, 2022 at 5:23 PM Ethan McCue <<a href="mailto:ethan@mccue.dev" target="_blank">ethan@mccue.dev</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto">What situation were you encountering the exception? Was it when trying to add to the returned list?<div dir="auto"><br></div><div dir="auto">If so, that's expected. Arrays.asList only wraps an underlying array, it can't grow it. By that measure List.of() is even more unintuitive because you can't set anything.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Nov 18, 2022, 11:06 AM Andreas Røsdal <<a href="mailto:andreas.rosdal@gmail.com" target="_blank">andreas.rosdal@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Hello! <br></div><div><br></div><div>I am an <span><span>aspiring JDK contributor, having used Java in my work as a developer.<br></span></span></div><div><br></div><div>I was recently surprised by an Exception thrown when using the java.util.Arrays.<span>asList() method</span> </div><div>so I would like to propose some improvements to this API. <span>In particular:<br>- When using  java.util.Arrays.<span>asList() then </span>AbstractList is throwing <span>UnsupportedOperationException which is not user-friendly or intuitive.<br>- <span> java.util.Arrays.<span>asList() returning a private class called <span>ArrayList, which is not the usual java.util.ArrayList, so it's not user-friendly or intuitive.<br></span></span></span></span></span></div><div><br></div><div>Since this would be my first contribution to the JDK, and the goal is to complete the contribution with accepted pull request and get the Arrays API improved, what would the first step to making this first improvement to the JDK be?</div><div><br></div><div>I would also like to share a link to an open source project I've been working on:<br></div><div><a href="https://github.com/fciv-net/fciv-net" rel="noreferrer" target="_blank">https://github.com/fciv-net/fciv-net</a></div><div><br></div><div>Thank you! <br></div><div><br></div><div>Regards,</div><div>Andreas R.<br></div></div>
</blockquote></div>
</blockquote></div></div>
</blockquote></div>