Our company has been slowly converting a medium-sized (~100K LOC) Java codebase to take advantage of some Java 8 features. One example is a utility method that accepts a String DB query and then executes a Consumer<ResultSet> for each resulting row. The utility method creates the connection, uses try-with-resources to ensure that it's properly closed, etc. This makes a lot of code a lot cleaner.
But unfortunately, many ResultSet operations can throw SQLException. So we created a `ConsumerE<T, E extends Exception>` to use in such cases, so that we can allow some lambdas to throw exceptions where it is sensible (InterruptedException, SQLException, and IOException being the major culprits).
Pretty soon we ended up with FunctionE, BiFunctionE, and so on.
At the same time, we found a need for more interfaces, such as ObjIntFunction<T, R>, that are not provided by JDK 8.
Rather than continuing to implement these on an as-needed basis, I decided to just solve the problem once-and-for-all by creating this library.
I had to register for this. You have pretty much tried to invent Either via code generation. I suggest you look at functionaljava's Either for further reference.
Code generation is in my experience a clear indication that the problem you have has not really been understood.
This was perhaps a 20-hour project, and we're already using it in our Java codebase. Are you instead recommending a Scala rewrite for a 100,000-line production system?
But unfortunately, many ResultSet operations can throw SQLException. So we created a `ConsumerE<T, E extends Exception>` to use in such cases, so that we can allow some lambdas to throw exceptions where it is sensible (InterruptedException, SQLException, and IOException being the major culprits).
Pretty soon we ended up with FunctionE, BiFunctionE, and so on.
At the same time, we found a need for more interfaces, such as ObjIntFunction<T, R>, that are not provided by JDK 8.
Rather than continuing to implement these on an as-needed basis, I decided to just solve the problem once-and-for-all by creating this library.