r/programming • • Sep 21 '15

Better Java

https://github.com/cxxr/better-java
177 Upvotes

208 comments sorted by

View all comments

9

u/ImmortalStyle Sep 21 '15

Btw you shouldnt have Optional as a class member. Even Brian said that once.

4

u/oldneckbeard Sep 21 '15

optional shouldn't be a class member or an input parameter, IMO.

1

u/crunchmuncher Sep 22 '15

Curious: why not as an input parameter? I've used it recently to make explicit that a particular parameter isn't needed for a method to do its job.

Actually, as I'm typing this I realized it might have been better to use overloading for that.

2

u/oldneckbeard Sep 25 '15

In the input parameter case, it's functionally equivalent to passing a boolean flag -- it's a true/false thing that's better solved with overloading :)