Wanted: overloading use cases

Dan Smith daniel.smith at oracle.com
Thu Oct 11 08:32:15 PDT 2012


On Oct 11, 2012, at 1:15 AM, Remi Forax <forax at univ-mlv.fr> wrote:

>> Yes, I was a bit unclear.  The _overloaded methods_ have different parameter types (e.g., IntMapper vs. LongMapper).  The _functional interface methods_ have the same parameter types (e.g., E).
>> 
>> (1) might have been better stated as "differing in a parameter type that is a different functional interface for each method", or something like that.
> 
> still not that clear because Mapper has two parameter types, E and R.

Let me try to clarify by "inlining" the function types.

interface Stream<E> {
  <R> Stream<R> map(Mapper<E, R> m);
  IntStream map(IntMapper<E> m);
  LongStream map(LongMapper<E> m);
}

Becomes:

interface Stream<E> {
  <R> Stream<R> map(E->R m);
  IntStream map(E->int m);
  LongStream map(E->long m);
}

These function types have the same parameter types -- they are all functions from 'E' to something.

I'm looking for examples in which the function types are _not_ all functions from the same parameter type.

—Dan


More information about the lambda-dev mailing list