Recently we had a discussion at work about the impact of local variables on the performance vs readability of Java code. Some of my colleagues are of the oppinion that declarati
Are they right in claiming this?
No, they are not. The cost of storing something in a local variable and then subsequently reading from it is next to 0, it's as simple as that -- this is definitely not something that you should spend your time optimizing, or even worrying about for that matter. Don't sacrifice readability by putting everything in a single, highly convoluted line.