3 ms·
"Kotlin then made functional programming a first class citizen" - what do you mean by this?
by marceloabsousa 6y ago
"Kotlin then made functional programming a first class citizen" - what do you mean by this?
- opnotme 6y agoNot OP, but I assume they meant: Kotlin encourages you to solve problems functionally, whereas Java merely allows you to do so. Kotlin provides features like top-level function declarations (don't need to be declared as methods of a class) and functions-as-arguments, both of which make it easier to think functions first.
- zests 6y agoIn Java if you want to map a function over a list you write `list.stream().map().collect()` and in Kotlin you write `list.map()`. The functional programming APIs in Java are atrocious. Lambdas are much easier to write thanks to anaphoric macros and other syntactic sugar. Data structures are immutable by default. A big one that isn't mentioned often is that functions can exist outside of classes so your code is not as tied to Java's style of OOP.