Previously, I ask a similar question, but the answer given only demonstrates the usage of multiple-type-parameters(MTP) data structure, but not MTP generic interface.
Based on my experience, generic interface is useful for generalizing algorithms. For example, the sorting algorithm can be defined as such:
// Java code
interface Comparable<T> {
Boolean compareTo(T other)
}
void <T extends Comparable<T>> sort(List<T> elements) {
// body
}
So, the code above demonstrated the usage of single-type-parameter generic interface.
However, I have not encountered any use case for multiple-type-parameter generic interface up until now.
Thus, I am hoping that some one could provide me some use cases regarding multiple-type-parameter interfaces.
Also, if possible, please explain how multiple-type-parameter could improve some situation.
(For example, the Comparable interface allows the sort function to be generalized, so that one do not need to define multiple sort function for different types of element)
P/S: I ask this question because I am considering whether to include MTP generic interface in my new programming language.