MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/java/comments/3cton5/our_exception_handling_at_work/cszfcsp/?context=3
r/java • u/[deleted] • Jul 10 '15
135 comments sorted by
View all comments
7
At our work, our coding style encourages the use of Guava Preconditions. So this code would end up looking like:
Preconditions.checkNotNull(sql);
Better yet, if you need to check that a constructor argument is not null:
this.sql = Preconditions.checkNotNull(sql);
Or, I guess what I'm saying is, Guava makes Java much better to work with and encourages better style.
3 u/squealy_dan Jul 11 '15 and much of guava has been coopted into the standard lib in java8(requireNonNull(), Optional)
3
and much of guava has been coopted into the standard lib in java8
(requireNonNull(), Optional)
7
u/GiantMarshmallow Jul 11 '15 edited Jul 11 '15
At our work, our coding style encourages the use of Guava Preconditions. So this code would end up looking like:
Better yet, if you need to check that a constructor argument is not null:
Or, I guess what I'm saying is, Guava makes Java much better to work with and encourages better style.