5

What do you guys think about the new "type inference" (var type) feature that will be introduced with Java SE 10? I know that C# already has that construct. It's pretty controversial among my peers... 😅

Comments
  • 0
    But.... Java 10 has released like months ago
  • 0
    @sharktits You're right, my bad. I thought it was still in beta or something 😅
  • 0
    If a variable's type is ambiguous, you're not naming things correctly.

    Type inference looks so much nicer.
  • 1
    You’ll get used to it, then you will be anoyed by code with unnecesary type declaration.

    When you rename a class, so much fewer lines of code will need replacement.

    You can even try it in older Java with Lombok’s „val”.

    BTW, Java already has sort-of type inference for variables: Lamda arguments don’t need declaration. Does anyone complain that the type is not explicit?
Add Comment