• 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
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

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

 
Author
Posts: 3473
  • 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: 3285
13
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: 4804
    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: 22818
    132
    Eclipse IDE Spring 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...
     
    You get good luck from rubbing the belly of a tiny ad:
    Smokeless wood heat with a rocket mass heater
    https://woodheat.net
    reply
      Bookmark Topic Watch Topic
    • New Topic