Saving fish by writing code! Applications developer in fisheries, specializing in webapps and moving 'enterprise-y' legacy systems to modern agile systems - Email or tweet me if you want to talk!
Thanks for the explanation. In general I agree at least with your readability over performance thingy.
I'd still go for the getter way tho. However I agree that using an optional as argument can be ok. I would still prefer doing something like throwing an illegal argument exception because npes are kinda ugly. Also to remove that if else clutter you could wrap the arg2 in an optional and map or else.
However that is not really related to immutability. I liked the article :)
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Here's one from Brian Goetz that a lot of people find convicing
I still disagree, obviously not everyone at Oracle is on board, so....
¯\(ツ)/¯
Thanks for the explanation. In general I agree at least with your readability over performance thingy.
I'd still go for the getter way tho. However I agree that using an optional as argument can be ok. I would still prefer doing something like throwing an illegal argument exception because npes are kinda ugly. Also to remove that if else clutter you could wrap the arg2 in an optional and map or else.
However that is not really related to immutability. I liked the article :)