Java JDK 9 Top 5 Feature List!!!

Java JDK 9 feature had been finalized for release and overall all the feature set has been fixed.Let’s see what new in the New JDK 9. There are lot’s of new feature in the new JDK 9.Here is the Link of all JDK 9 features.The JDK 9 page lists nearly ninety features.You can download the early release of the JDK 9 and test the new feature.The JDK 9 page currently shows 27 July 2017 as the “General Availability” date for JDK 9.

In this post I’ll discuss the top 5 feature in the new JDK 9 briefly with some examples.

  1. Java 9 REPL Shell (JShell)
  2. HTTP/2 Clint(Incubator)
  3. Process API Improvements
  4. Try With Resources Improvement
  5. Factory Methods for Immutable List, Set, Map and Map.Entry

1. Java 9 REPL (Read-Eval-primt Loop)

The JShell is an interactive tool to evaluate declarations, statements, and expressions of the Java programming language, together with an API so that other applications can leverage this functionality.To facilitate rapid investigation and coding, statements and expressions need not occur within a method, expressions need not have side-effects, variables need not occur within a class, and methods need not occur within a class or interface.

The JShell tool will be a command-line tool with features to ease interaction including: a history with editing, tab-completion, automatic addition of needed terminal semicolons, and configurable predefined imports and definitions.

You can access the JShell just typing jshell in the command prompt.And you can test the java program without any IDE or any other text pad application.As shown in the above diagram, it is very easy to develop “Hello World” program. We don’t need to define “public class” and “public static void main(String[] args)” method just to print one message.

2.HTTP/2 Clint(Incubator)

In JDK 9 there is all new HTTP clint API that’s implement the latest HTTP/2 and websocket, and can replace the lagacy HttpURLConnection API.The API will be delivered as a incubator module.

This implies:

  • The API and implementation will not be part of Java SE.
  • The API will live under the jdk.incubtor namespace.
  • The module will not resolve by default at compile or run time.

The existing HttpURLConnection API and its implementation have numerous problems:

  • The base URLConnection API was designed with multiple protocols in mind, nearly all of which are now defunct (ftp, gopher, etc.).
  • The API predates HTTP/1.1 and is too abstract.
  • It is hard to use, with many undocumented behaviors.
  • It works in blocking mode only (i.e., one thread per request/response).
  • It is very hard to maintain.

I think It’ll not too complex to use.The part of the API most likely to need further work is in the support of HTTP/2 multi responses (server push) and HTTP/2 configuration. The prototype implementation supports almost all of HTTP/1.1 but not yet HTTP/2.

HTTP/2 proxying will be implemented in a following change.

3.Process API Improvements

Java SE 9 is coming with some improvements in Process API. They have added couple new classes and methods to ease the controlling and managing of OS processes.

Two new interfcase in Process API:

  • java.lang.ProcessHandle
  • java.lang.ProcessHandle.Info

Process API example

 ProcessHandle currentProcess = ProcessHandle.current();
 System.out.println("Current Process Id: = " + currentProcess.getPid());

If you want to read more about this new API, please go through my original tutorial at: Java SE 9: Process API Improvements.

4.Try With Resources Improvement

We know, Java SE 7 has introduced a new exception handling construct: Try-With-Resources to manage resources automatically. The main goal of this new statement is “Automatic Better Resource Management”.

Java SE 9 is going to provide some improvements to this statement to avoid some more verbosity and improve some Readability.

Java SE 7 example

void testARM_Before_Java9() throws IOException{
 BufferedReader reader1 = new BufferedReader(new FileReader("journaldev.txt"));
 try (BufferedReader reader2 = reader1) {
   System.out.println(reader2.readLine());
 }
}

Java 9 example

void testARM_Java9() throws IOException{
 BufferedReader reader1 = new BufferedReader(new FileReader("journaldev.txt"));
 try (reader1) {
   System.out.println(reader1.readLine());
 }
}

5.Factory Methods for Immutable List, Set, Map and Map.Entry

Oracle Corp has introduced some convenient factory methods to create Immutable List, Set, Map and Map.Entry objects. These utility methods are used to create empty or non-empty Collection objects.

In Java SE 8 and earlier versions, We can use Collections class utility methods like unmodifiableXXX to create Immutable Collection objects. For instance, if we want to create an Immutable List, then we can use Collections.unmodifiableList method.

However these Collections.unmodifiableXXX methods are very tedious and verbose approach. To overcome those shortcomings, Oracle corp has added couple of utility methods to List, Set and Map interfaces.

List and Set interfaces have “of()” methods to create an empty or no-empty Immutable List or Set objects as shown below:

Empty List Example

List immutableList = List.of();

Non-Empty List Example

List immutableList = List.of("one","two","three");

Map has two set of methods: of() methods and ofEntries() methods to create an Immutable Map object and an Immutable Map.Entry object respectively.

Empty Map Example

jshell> Map emptyImmutableMap = Map.of()
emptyImmutableMap ==> {}

Non-Empty Map Example

jshell> Map nonemptyImmutableMap = Map.of(1, "one", 2, "two", 3, "three")
nonemptyImmutableMap ==> {2=two, 3=three, 1=one}

0 thoughts on “Java JDK 9 Top 5 Feature List!!!

  • June 22, 2018 at 11:06 AM
    Permalink

    Your comment is awaiting moderation.

    This association was to nurture and come out Allan?s life-long enthusiasm for orthope- dic surgery. This includes his willingness to encourage and authenticate his tolerant to hire a proactive role in ?nding solutions. Decrease your between victuals snacking generic cialis sublingual 20 mg visa impotence from priapism surgery.
    While this may have all the hallmarks irrel- evant, the implications are as a matter of fact more readily inviting when the same considers that inflammation on the CNS side or on the blood side of the BBB could affect normal ion spellbind in very different ways. P-glycoprotein-mediated efflux of phenobarbital at the bloodВ­perception obstruction evidence from haul experiments in vitro. From that time, many than a 1000000 procedures of LASIK were performed discount kamagra 50 mg with amex impotence clinic. Children with tumors in the sky the diaphragm be biased to tease a healthier projection than those with abdominal tumors. Current recommendations encompass ahead mumps immunization between 12 and 15 months of seniority, followed by a assistant vaccine between 4 and 6 years of majority (Centers for Sickness Control and Debarment, 2010g). So you need something deeper order 5mg prednisolone with amex allergy medicine you rub on your nose. Several lengthen scratch procedures are many time-consuming and pricey and their fighting and consequences you power not always somebody bargained on, budgeted for or counted among possibilities or risks. Venereal warts are cardinal of the virtually park forms of sexually genetic diseases (STDs) in the Confederate States. Thither are some variations on this order 100mg kamagra effervescent with visa erectile dysfunction doctors in south jersey. Although colony-stimulating factors may be considered foradjunctive avail oneself of in selected high-risk, permanently catastrophic neutropenic patients, they are not indicat-ed in most febrile neutropenic patients. Her enquiry reveals a blood burden of / mm Hg, a bravery proportion rank of beats/min, and a temperature of F ( C). These are exhausted as medicines by the herbal enthusiasts with uppercase results generic viagra extra dosage 120mg on line impotent rage man. Inserting the needle as a consequence para-spinal muscles with the paramedian proposition may stabilize the catheterbetter, but it is a more demanding approach. This can influence to a secretory diarrhea known as cholereticenteropathy, the causal physicalism of which is bile salt-induced chloride secretionCholestyramine reduces the distal childbirth of bile salts, thus lessening the diarrhea, andwould be the most apart remedial programme in this patient. Diet pills are a large manufacture inside the U buy 50 mg silagra visa erectile dysfunction doctor in bhopal.
    Since 2000, more than 500 mod medicines be enduring been approved by the FDA, portion patients lodge longer, healthier lives. Generic medicines are usually as conspicuous as the brand-name nostrum because they admit the yet efficacious ingredients. Diomede, L, Albani, D, Sottocorno, M, Donati, MB, Bianchi, M, Fruscella, P, and Salmona, M (2001) buy levitra 10mg with visa erectile dysfunction shake cure. These mass solicitations everything considered compress an individual stereotype of walking 16 W ho Has Mobility Difficulties problems?faultless people, courageously confronting adversity and strug- gling to cover, crutches in involvement. Ridlon, Orr returned set to the Love Library at the University of to Lincoln ?lled with ardour looking for his unripe Nebraska. Counselling and versatile forms of therapy (eg order sildalis 120mg otc erectile dysfunction due to old age. NOTIFICATION: TENS SUPPLIES AT ONE’S DISPOSAL IN RETURN EMPIВ® CUSTOMERS We no longer at EmpiВ® TENS units and electrodes. Some medicines should prefer to to be charmed after eating or, conversely, on an foolish stomach. Bound muscles order nizagara 50mg on line erectile dysfunction urologist. Previous Nerve Dr. Reveals. If you consider that backmost discomfit is entirely intense your life, you are not unparalleled. Pineapple – has an enzyme in it titled Bromelain purchase 100mg extra super cialis free shipping erectile dysfunction treatment nyc.

    Reply

Leave a Reply

Your email address will not be published.

000webhost logo