Joe Soltzberg

60%
Flag icon
Note that we pass in an exception factory rather than an actual exception. This avoids the expense of creating the exception unless it will actually be thrown: Click here to view code image // Using an optional to throw a chosen exception Toy myToy = max(toys).orElseThrow(TemperTantrumException::new);
Joe Soltzberg
Cool
Effective Java
Rate this book
Clear rating
Open Preview