2 ms·
Interesting, I first looked at the second code segment and really didn't like it. However, I think thats just the whole Java checked exception thing (which I th
by arethuza 14y ago
Interesting, I first looked at the second code segment and really didn't like it. However, I think thats just the whole Java checked exception thing (which I think everyone now regards as a mistake) - if you removed the throws and everything after it on that line it actually looks quite sensible and much better than simply returning null to mean "it didn't work for some reason I'm not going to tell you about".
- mtrimpe 14y agoExactly. It's essentially as close as you can (legibly) get to an Option/Maybe monad in Java.