-
Notifications
You must be signed in to change notification settings - Fork 7
Description
I love your approach! This is the way to go for those who, like me, don’t like sneaky throws.
I just reviewed several popular SO questions that deal with the “streams and checked exceptions” issue, and found only your library as a solution for those who want no library that sneaky throw among their dependencies, among the ones that these questions reference (though I may have missed some):
- Java 8: How do I work with exception throwing methods in streams?
- Java 8: Lambda-Streams, Filter by Method with Exception
- Aggregate runtime exceptions in Java 8 streams
- How can I throw CHECKED exceptions from inside Java 8 streams?
Now to my question. Why do you require a class parameter designating the exception thrown, when creating a ThrowingStream? This seems unnecessary to me, and makes usage less elegant from the caller’s point of view. At least, the example in the wiki can be modified so as to avoid usage of the parameter Class<X> x in the StreamAdapter constructor (I just did it). Is there something that has escaped me?