jOOλ author here.
The difficulty you seem to be having is the idea that ordinary methods in business logic and specific library functions are somewhat related. They're not. Let me explain:
An ordinary method in business logic ...
... should indeed not take many more than three arguments, because as soon as you exceed that number, chances are that some of your arguments are strongly connected in a way that it is worth re-designing them into a class.
That's object orientation basics and works well for a variety of use-cases.
A specific method / function in a more technical library ...
... on the other hand is not restricted to such object orientation design principles. In the case of jOOλ, the library actually works around a (several) language limitation(s), in particular the lack of first class tuple support.
Many languages out there (SQL being among the most prominent ones) support tuples, which are just like classes in Java with the difference of:
- Being structurally typed as opposed to nominally typed
- Having their attributes ordered (accessible by name and index) as opposed to having them in random order (accessible by name only)
Think of a Tuple16<T1, T2, ..., T16>
as the same thing as a Java class with 16 named attributes (and getters / setters, if you like). Think of a Function16<T1, T2, ..., T16, R>
as the same thing as a Java method that accepts such a class with 16 named attributes.
So, these differences are of mostly stylistic nature. There's not really a strict advantage of one approach over the other in general.
Now, if you're a functional / declarative programmer who happens to work with Java, the limitations of the Java language and the JDK APIs limit the way you reason about your programs. This is one of the reasons why jOOλ exists, to help these people pretend the Java language actually had tuples and functions applied to tuples, and in order to emulate that, well, jOOλ has to "overload" the same kind of function 16 times - 16 being an arbitrary upper limit (.NET limits tuples to degree 8, Scala limits them to 22).
Answering your specific questions
My question is there are 1-16 parameter functional interfaces supported by this library. Do this makes sense at all?
Yes, even if you usually only use the ones with lesser degree, you will occasionally find a Tuple16<T1, T2, ..., T16>
useful, just like when you design classes, which mostly have only a few attributes, you'll find yourself writing an occasional class with 16+ attributes.
Though acceptable number varies according to different thought leaders on it. But no one says 16.
Free your mind from object oriented dogma. There's always a reason why a thought leader says something. It is true in a context, but never universally true. Have you ever written a SQL query with 16 columns? Sure you have. Why is it acceptable in SQL but not in Java?
Also, it provides a utility class Seq which looks like is limited to sequential processing only.
Yes, that's the main design goal. Sequential processing allows for quite a bit of additional functionality that doesn't make sense in parallel processing, yet is dearly missing from the JDK's Stream API.
Can someone with good past experience using JOOL answer why I should be using JOOL as looks like lots of things it contains are of no use?
If you do not see its use, then don't use it. But from your comments (you seem to prefer passing around Object[]
over typed tuples), I think you do understand its use, you just don't want to write down the types, because what's an Object[]
, if not a poor man's, untyped tuple with random degree?