- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
Is it possible to implement scala.Function2 in java?
Tue, 2011-08-02, 23:46
Is there any hope to implement scala.Function2 in java? How?
I'm interested in apply(T1, T2), but Function2 defines more than two
hundred methods - for example, curry$mcFDJ$sp() and so on.
Wed, 2011-08-03, 09:57
#2
Re: Is it possible to implement scala.Function2 in java?
On Wed, Aug 3, 2011 at 12:01 AM, Seth Tisue <seth [at] tisue [dot] net> wrote:
To be clear, AbstractFunction2 was introduced in order to reduce bytecode required for each anonymous functions (particularly in light of specialization). That is why it's in the scala.runtime package. A positive side-effect is that it helps implementations of Function2 in Java.
Best,Ismael
scala.runtime.AbstractFunction2 exists for this purpose. (It's an abstract class that extends the Function2 trait.)
To be clear, AbstractFunction2 was introduced in order to reduce bytecode required for each anonymous functions (particularly in light of specialization). That is why it's in the scala.runtime package. A positive side-effect is that it helps implementations of Function2 in Java.
Best,Ismael
Wed, 2011-08-03, 17:47
#3
Re: Is it possible to implement scala.Function2 in java?
Thanks, it works!
> > implement scala.Function2 in java? How?
>
> scala.runtime.AbstractFunction2










On Tue, Aug 2, 2011 at 6:46 PM, Guntis Ozols wrote:
> Is there any hope to implement scala.Function2 in java? How?
> I'm interested in apply(T1, T2), but Function2 defines more than two
> hundred methods - for example, curry$mcFDJ$sp() and so on.
scala.runtime.AbstractFunction2 exists for this purpose. (It's an
abstract class that extends the Function2 trait.)