Kotlin has an "extensions" feature that is more powerful than simply
calling a Java method from Kotlin. Here's an example, from the Kotlin
language guide:

fun <T> MutableList<T>.swap(index1: Int, index2: Int) {
    val swap = this[index1] // 'this' corresponds to the list
    this[index1] = this[index2]
    this[index2] = swap
}

Not only does this add a new swap() function to lists, it effectively adds
the function to any subclass of MutableList. So If I instantiate an
ArrayList, I can call the swap() method as if it were a member function.
This creates opportunities for giving users a cleaner interface to the
standard Apache commons methods that we should take advantage of.

I think this is an excellent idea, and I'd be happy to take part in the
project.

— Miguel Muñoz


On Mon, Aug 17, 2020 at 6:13 PM Hasan Diwan <hasan.di...@gmail.com> wrote:

> Couldn't you follow  the directions at
> https://kotlinlang.org/docs/reference/java-interop.html to call the Java
> methods from Kotlin? Or am I missing something? -- H
>
> On Mon, 17 Aug 2020 at 17:45, Miguel Muñoz <swingguy1...@gmail.com> wrote:
>
> > I'd be happy to join you.
> >
> > On Mon, Aug 17, 2020 at 5:24 AM Adwait Kumar Singh <
> > theadvaitkumarsi...@gmail.com> wrote:
> >
> > > Hi all,
> > >
> > > I created this issue https://issues.apache.org/jira/browse/LANG-1599
> to
> > > discuss the possibility of creating a Kotlin version of the current
> > project
> > > which would leverage extension functions to provide cleaner and concise
> > > utility functions. Also we would only include those methods which are
> not
> > > provided as part of the Kotlin standard library itself.
> > >
> > > Wanted to know if we wanted to do this and what it would take to start
> > this
> > > project.
> > >
> > > Thanks,
> > > Adwait.
> > >
> >
>
>
> --
> OpenPGP:
> https://sks-keyservers.net/pks/lookup?op=get&search=0xFEBAD7FFD041BBA1
> If you wish to request my time, please do so using
> *bit.ly/hd1AppointmentRequest
> <http://bit.ly/hd1AppointmentRequest>*.
> Si vous voudrais faire connnaisance, allez a *bit.ly/hd1AppointmentRequest
> <http://bit.ly/hd1AppointmentRequest>*.
>
> <https://sks-keyservers.net/pks/lookup?op=get&search=0xFEBAD7FFD041BBA1
> >Sent
> from my mobile device
> Envoye de mon portable
>

Reply via email to