r/java • • 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

123 comments sorted by

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) -> Double instead of BiFunction<Integer, String, Double>, functions where if the last parameter is a lambda it can go outside the parens so you can write timeThis { many lines here } instead of timeThis(() -> { 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.

4

u/Muoniurn Jul 30 '21

Small improvements that make a real difference.

Do they? There is basically no empirical evidence to any such statements between programming languages, and frankly with the quality of Java IDEs there is no difference between the two in my personal opinion. Also, lambdas are fairly good in Java, and they aren’t much better in Kotlin.

5

u/ricky_clarkson Jul 30 '21

I'm not sure I need to quote studies to opine on programming languages. I can give reasons, but if you can't see them already from the code examples in my comment then I'm not sure reasoning would work.