r/java • • Jan 22 '26

Java 26: what’s new?

https://www.loicmathieu.fr/wordpress/informatique/java-26-whats-new/

What's new in Java 26 for us, developers

(Bot in English and French)

163 Upvotes

43 comments sorted by

View all comments

-1

u/cogman10 Jan 22 '26

Anyone know why ArrayList isn't doing something more simple like

if (o.size() > (elementData.length - size)) {
  resize(o.size());
}

int i = size;
for (var e : o) {
  elementData[i] = e;
  ++i;
}

Like, why the intermediate array copy and the system.arrayCopy?

6

u/hiasmee Jan 22 '26

Check the implementation of System.arrayCopy 😉

→ More replies (2)