DEV Community

Discussion on: Java 15 in 2020: Reasons to *not* use Java?

Collapse
 
brunoborges profile image
Bruno Borges • Edited

Hasn't features like Type-Inference (var), lambdas, new APIs in the Collections Framework, and recently Records and pattern matching helped in any form to reduce the verbosity?

I mean, this is a possibility with Java 15:


public record Person(String name, int age) {}

public class Process {

  public void process() {
    var p0 = new Person("a", 18);
    var p1 = ...;

    var list = List.of(p0, p1);

    // sum all ages
     list.stream().mapToInt(Person::age).sum();
  }
}
Thread Thread
 
bmorearty profile image
Brian Morearty

Yup, glad to see those advances. It’s taken much, much too long IMO for the language to catch up and introduce things like that. I gave up on it before those were part of the language, and that was after 15 years of waiting.