Java's problem is that for many years it used to be the slowest car around. Maybe this was one of the things that helped Java become the undisputed ruler Enterprise Inc. but now it's got a lot to catch up with, and even though the pace has picked up since Java 9, it's far behind its competitors.
Everything you mention (var, lambdas, streams) and everything you might mention when Java 13 comes out (switch expressions, text blocks) is just too little, too late.
Yeah, var is a lifesaver if you have to use Java, but compare the limited type inference it brings to the table with almost any other competing language (Kotlin, C#, Scala or Swift) which at the very least can do a return value inference.
Likewise, streams are long due, but the syntax is horrible and the repertoire of built-in operations is meager, and since Java does not support extension functions like the rest of the languages mentioned here you can't extend them gracefully.
If you take one of the examples given here:
var grades = school.students()
.stream()
.flatMap(student -> student.grades()
.stream()
.map(grade -> new NamedGrade(student.name(), student.grades())
.filter(x -> x.grade() > 60)
.collect(Collectors.toList());
Kotlin goes the same route, but makes it little more natural to use: val grades = school.students
.flatMap { (name, grades) -> grades.map {
NamedGrade(name, it)
}}
.filter { it.grade() > 60 }
.toList()
Besides simply more natural syntax, get the special 'it' variable, destructuring, more operations andNow take C#, a language had something "Streams" since version 3.0 (released 7 years before Java 8):
var result = students
.SelectMany(student => student.Grades.Select(grade => new { Name = student.Name, Grade = grade }))
.Where(record => record.Grade > 60);
Where you get anonymous records - you don't need to define a new type anymore.Or with LINQ:
var result = from student in students select
from grade in student.Grades
where grade > 60
select new { Name = student.Name, Grade = grade };
You get a highly readable built-in query language as well.