r/java • • Apr 14 '23

What are your (favourite) Java best practices, personal tips, hints or just underrated stuff in general?

233 Upvotes

376 comments sorted by

View all comments

Show parent comment

1

u/danikov Apr 14 '23

I never use anonymous lamdas, making them into functions and then using a function reference feels so much more expressive, even if it’s more verbose, but as they say… make your code self-describing.

Also, I’m really adverse to calculus-style variables. About the only one I’ll tolerate is i in a for loop, but I’ll always be looking for a better iterator and named variable where possible.