Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It is possible for a compiler to optimize long method chains into the equivalent imperative code. The rust compiler is an example, and in the case of the iterator trait, it can actually be optimized better than the equivalent imperative code, by removing checks when indexing into the array.


The default Java compiler doesn't do much optimizing. This is intentional, so there would be incentive to make the JVM really smart (a great decision, I think). But it's possible that the JVM doesn't optimize streams that well at this time.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: