Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

What are your top 5 features that you love about Java 7?

 
arulk pillai
Author
Ranch Hand
Posts: 3387
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you have to list 5 best features of Java 7 that you wish you had a while ago what would that be?

Are there any pitfalls that you wished was addressed in Java 7?
 
Martijn Verburg
author
Bartender
Posts: 3275
5
Eclipse IDE Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For me it's invokedynamic, Diamond Operator, try-with-resources, NIO.2 API and multi-catch. I was pretty happy with the scope of Java 7, invokedynamic will prove to be its most important feature going forwards....
 
SbhargavS Surimenu
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For me

  • Resource releasing without having finally block
  • [list]switch case variables accepting the string literals
  • Allowing underscores in between digits. Numeric value is more readable when we use underscores in between (e.g. Debit card or credit card number is 16 digit so if you use underscore in between for every 4 digits).




  • Regards,
    Bhargav

     
    Pat Farrell
    Rancher
    Posts: 4678
    7
    Linux Mac OS X VI Editor
    • Likes 1
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    SbhargavS Surimenu wrote:
  • switch case variables accepting the string literals


  • I can't understand why this wasn't in Java 1.1 or some other early release. Its so obvious. And strings are constants, why the delay?
     
    R. Jain
    Ranch Hand
    Posts: 375
    1
    Java Python Ubuntu
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    For me, it's Diamond Operator, Catch multiple Exceptions, Try with Resources, Switch with String literals, and InvokeDynamism
     
    Andrew Desmond
    Greenhorn
    Posts: 1
    Eclipse IDE Java Netbeans IDE
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    1. Switch with Strings
    2. Enhanced For loop
    3. Try with resources
    4. underscores between digits (I don't know how many times I've missed a zero when writing large numbers resulting in headaches later on)
    5. Diamond operator
     
    Martin Vajsar
    Sheriff
    Posts: 3752
    62
    Chrome Netbeans IDE Oracle
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Andrew Desmond wrote:2. Enhanced For loop

    That one was actually introduced earlier, in Java 5 I believe. But if it was introduced in Java 7, it would be my favorite Java 7 feature by a wide margin.
     
    Esteban Herrera
    author
    Ranch Hand
    Posts: 42
    1
    Eclipse IDE Java Spring
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Pat Farrell wrote:I can't understand why this wasn't in Java 1.1 or some other early release. Its so obvious. And strings are constants, why the delay?


    Apparently because of performance. Here is a good explanation http://stackoverflow.com/questions/338206/switch-statement-with-strings-in-java

    My list:
    1. Resource management in try blocks
    2. Using strings in switch statements
    3. Numeric literals with underscores
    4. Multicatch blocks
    5. NIO 2.0 API
     
    Gowtham Gutha
    Greenhorn
    Posts: 1
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    NimbusLookAndFeel
     
    Rob Spoor
    Sheriff
    Pie
    Posts: 20550
    57
    Chrome Eclipse IDE Java Windows
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    That's been available for quite a while already.
     
    D Rog
    Ranch Hand
    Posts: 472
    Linux Objective C Ubuntu
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    I put my thoughts with code examples http://www.infoq.com/articles/java7-nio2

    Quick recap:
    1. new file io giving control over modern file systems especially POSIX alike.
    2. Auto resources freeing
    3. Forks for easier parallel programming
    4. Switch with "String" cases (absolutely love it)
    5. <> for reducing typing efforts

    6. Just forgot variable arguments improvements giving me possibility to create generic arrays.

    I am spoiled by Java 7 and can't wait using Java 8 with default methods, enclousers and other bells and whistles. What about you?
     
    Abhay Agarwal
    Ranch Hand
    Posts: 1376
    Eclipse IDE Java
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Same here .. waiting for Java 8 release... just download intermediate version of Java 8 binaries ... waiting to know what features shall be included in Java 8...
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic