<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">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>