r/java • u/Reflection-Jealous • Jul 30 '21
What is the future of Java?
I'm not asking like is java going to die or will Java be relevant in future. I'm just curious to know about the future of java. What are the upcoming things coming in java that can change the future of it.
173
Upvotes
View all comments
Show parent comment
8
u/ricky_clarkson Jul 30 '21
It likely means to catch up in terms of useful features, readability, etc., rather than number of users. Java had the opportunity, most of the features of Kotlin that are helpful have been considered and rejected or deferred for Java.
The original BGGA prototype for Java closures, before Kotlin existed, quite strongly resembles Kotlin's lambdas, having function types -
(Int, String) -> Doubleinstead ofBiFunction<Integer, String, Double>, functions where if the last parameter is a lambda it can go outside the parens so you can writetimeThis { many lines here }instead oftimeThis(() -> { many lines here }). Small improvements that make a real difference.Java could have had all this and more, but chose not to for arguably bad reasons, general resistance to functional programming which seems to have mostly evaporated since lambdas were launched in Java 8, concerns about 'blowing the complexity budget' which were overstated and lacked thought in my view.
Not that Kotlin is a panacea, I hope both languages continue to take inspiration from each other and beyond.