Java 8 Top Tips | IntelliJ IDEA Blog
I've been working a lot with Java 8 code over the last couple of years, for both new applications and migrating existing ones, and it feels like the right time to write down some of the "best practices" I've found useful. I personally dislike the term "best practices" as it implies a "one size fits all" solution, and of course coding doesn't work that way – it's down to us as developers to figure out what will work in our situation. But I have discovered I have particular preferences for Java 8 code that I find makes my life a little easier, and I thought I'd start a discussion on this topic.
Optional
Optional
is a highly underrated feature, and one that has the potential to remove a lot of those NullPointerExceptions
that can plague us. It's particularly useful at the boundaries of code (either APIs you're using or APIs you're exposing) as it allows you and your calling code to reason about what to expect.
Read full article from Java 8 Top Tips | IntelliJ IDEA Blog
No comments:
Post a Comment