• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

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

 
Author
Posts: 3461
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
author
Posts: 3281
8
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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....
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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

     
    Rancher
    Posts: 4686
    7
    Mac OS X VI Editor Linux
    • Likes 1
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • 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?
     
    Ranch Hand
    Posts: 375
    1
    Python Java Ubuntu
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    For me, it's Diamond Operator, Catch multiple Exceptions, Try with Resources, Switch with String literals, and InvokeDynamism
     
    Greenhorn
    Posts: 1
    Netbeans IDE Eclipse IDE Java
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • 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
     
    Sheriff
    Posts: 3837
    66
    Netbeans IDE Oracle Firefox Browser
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • 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.
     
    author
    Posts: 42
    1
    Eclipse IDE Spring Java
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • 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
     
    Greenhorn
    Posts: 1
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    NimbusLookAndFeel
     
    Sheriff
    Posts: 22683
    128
    Eclipse IDE Spring VI Editor Chrome Java Windows
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    That's been available for quite a while already.
     
    Ranch Hand
    Posts: 472
    Objective C Ubuntu Linux
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • 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?
     
    Ranch Hand
    Posts: 1376
    Eclipse IDE Java
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • 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...
     
    If you like strawberry rhubarb pie, try blueberry rhubarb (bluebarb) pie. And try this tiny ad:
    the value of filler advertising in 2021
    https://coderanch.com/t/730886/filler-advertising
    reply
      Bookmark Topic Watch Topic
    • New Topic