r/java • u/loicmathieu • 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)
161
Upvotes
View all comments
Show parent comment
3
u/cogman10 Jan 22 '26
Easily fixed with something like this.
That's not so much the problem. The bigger issue is that you are iterating over every element in the collection twice while also allocating an array for those elements.
The array copy is very fast, but it's still a second iteration.