Re:JEP 443: Unnamed Patterns and Variables (Preview)
by kaba0 on Wednesday March 22, 2023 @03:22AM
(#35257864)
It is a contrived example, but the idea/code pattern isn’t — I have written plenty of code where I had to iterate over a collection with a for loop, but didn’t use the exact element.
But obviously for typical usage one should probably just use the stream API.
Re:JEP 443: Unnamed Patterns and Variables (Preview)
by frant-hartm on Wednesday March 22, 2023 @03:30AM
(#35257911)
Orders may be Iterable, which doesn't have length/size().
That seems like a very contrived example. I don't work with Java regularly, but wouldn't that be better written as something like this?