• Like
  • Save
Java 7 new features
Upcoming SlideShare
Loading in...5
×
 

Java 7 new features

on

  • 371 views

 

Statistics

Views

Total Views
371
Views on SlideShare
368
Embed Views
3

Actions

Likes
1
Downloads
2
Comments
0

1 Embed 3

http://www.linkedin.com 3

Accessibility

Upload Details

Uploaded via as OpenOffice

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Java 7 new features Java 7 new features Presentation Transcript

    • Java 7 New Features
    • Diamond OperatorMap<String, List<Offer>> offers = new HashMap<>();
    • Strings in switch statementsString status = offer.getStatus();switch(status) {case NEW: newOffer(offer); Case Label break;case PENDING: toString() pendingOffer(offer); break;default: break;}
    • Automatic Resource Management Automatic close Multiple Resourcestry(FileOutputStream fos = new FileOutputStream(“movies.txt”);DataOutputStream dos = new DataOutputStream(fos)) { dos.writeUTF(“Java 7 New Features”)} catch (IOException e) { ...} Implements java.lang.AutoCloseable try-with-resources statement
    • Numeric literals with underscore int thousand = 1_000; int million = 1_000_000;
    • Binary literals int two = 0b10; int forty = 0b101_000;
    • Improved exception handlingtry { methodThatThrowsThreeExceptions();} catch (ExceptionOne | ExceptionTwo | ExceptionThree e) { ...} Multi-catch block
    • NIO 2.0● Working with Path: Path, Paths, FileSystem, FileSystems, ...● File change notifications: WatchService, WatchKey
    • Fork and Join Framework● ForkJoinPool int numberOfProcessors = Runtime.getRunTime().availableProcessors();● RecursiveAction ForkJoinPool pool = new (void compute()) ForkJoinPool(numberOfProcessors) …● RecursiveTask<V> public class BigProblemTask extends (V compute()) RecursiveAction { @Override protected void compute() { // your problem invocation goes here } } … pool.invoke(task);