for the sake of interest, I went to the sources of the kotlin and found there a file with the declared interfaces of 22 functions (function of 1 variable, 2, …22). It became interesting to know why this is the case and why to create such interfaces at all

When you use a function type, it is just syntactic sugar for using one of those interfaces.

  • ( ) -> R becomes Function< R >
  • ( P ) -> R becomes Function< P, R >
  • etc
1 Like