In Java (1.7), is it possible to define multiple interfaces with the same name, but with a different number of type parameters? What I'm essentially looking for is in spirit similar to the Func<TResult>
, Func<T1, TResult>
, Func<T1, T2, TResult>
, Func<T..., TResult>
delegate types of .NET. Very much like optional type parameters.
Exists such a functionality in the Java language or am I limited to creating different interfaces with names such as Func0<TResult>
, Func1<T1, TResult>
, Func2<T1, T2, TResult>
?
F<A>
andF<A,B>
over declaringF1<A>
andF2<A,B>
? They are two different types anyway. It would only make sense if you can declare the function’s method to have that magic type signature of taking all type arguments the class has. That boils down to the missing tuple type… – Crashaw