using Reflection API and Parameter.getName() method) and the byte-code (using new javac compiler argument –parameters).

01 02 03 04 05 06 07 08 09 10 11 12 13 package com.javacodegeeks.java8.parameter.names; import java.lang.reflect.Method; import java.lang.reflect.Parameter; public class ParameterNames { public static void main(String[] args) throws Exception { Method method = ParameterNames. class.getMethod( "main", String[]. class ); for ( final Parameter parameter: method.getParameters() ) { System.out.println( "Parameter: " + parameter.getName() ); } } }

If you compile this class without using –parameters argument and then run this program, you will see something like that:

1 Parameter: arg0

With –parameters argument passed to the compiler the program output will be different (the actual name of the parameter will be shown):

1 Parameter: args

For experienced Maven users the –parameters argument could be added to the compiler using configuration section of the maven-compiler-plugin:

01 02 03 04 05 06 07 08 09 10 < plugin > < groupId >org.apache.maven.plugins</ groupId > < artifactId >maven-compiler-plugin</ artifactId > < version >3.1</ version > < configuration > < compilerArgument >-parameters</ compilerArgument > < source >1.8</ source > < target >1.8</ target > </ configuration > </ plugin >

Latest Eclipse Kepler SR2 release with Java 8 (please check out this download instructions) support provides useful configuration option to control this compiler setting as the picture below shows.

Picture 1. Configuring Eclipse projects to support new Java 8 compiler –parameters argument

Additionally, to verify the availability of parameter names, there is a handy method isNamePresent() provided by Parameter class.

4. New Features in Java libraries

Java 8 adds a lot of new classes and extends existing ones in order to provide better support of modern concurrency, functional programming, date/time, and many more.

4.1. Optional

The famous NullPointerException is by far the most popular cause of Java application failures. Long time ago the great Google Guava project introduced the Optionals as a solution to NullPointerExceptions, discouraging codebase pollution with null checks and encouraging developers to
using Reflection API and Parameter.getName () method) and the byte - code (using new javac compiler controversy – argument). 

 01 02 03 04 05 06 07 08 09 10 11 12 13 package com.javacodegeeks.java8.parameter.names; import java.lang.reflect. Method; import java.lang.reflect. Parameter; public class ParameterNames { public static nothingness main(String [ ] args) throws Exception { Method method = ParameterNames. class.getMethod (" main ", String [ ]. course); for (concluding Parameter parameter: method.getParameters ()) { System.out.println (" Parameter: " + parameter.getName ()); } } } 

 If you compile this class without using – parameter argument and then run this broadcast, you will determine something like that: 

 1 Parameter: arg0 

 With – parameters argument passed to the compiler the program output will be unlike (the actual name of the parameter will be shown ): 

 1 Parameter: args 

 For experienced Maven users the – parameter argument could be added to the compiler practice configuration part of the maven - compiler - plugin: 

 01 02 03 04 05 06 07 08 09 10 < plugin > < groupId > org.apache.maven.plugins</ groupId > < artifactId > maven - compiler - plugin</ artifactId > < version > 3.1</ version > < configuration > < compilerArgument > -parameters</ compilerArgument > < source > 1.8</ source > < target > 1.8</ prey > < / configuration > < / plugin > 

 Latest Eclipse Kepler SR2 release with Java 8 (please check out this download instructions) support provides useful configuration option to control this compiler setting as the picture below shows. 

 Picture 1. Configuring Eclipse projects to support fresh Java 8 compiler – parameters argument 

 Additionally, to affirm the handiness of argument names, there is a handy method isNamePresent () provided by Parameter class. 

 4. New Features in Java libraries 

 Java 8 adds a lot of new class and extends existing ones in order to provide better accompaniment of modern concurrency, functional programming, date / meter, and many more. 

 4.1. Optional 

 The famous NullPointerException is by far the about democratic lawsuit of Java application failures. Long meter ago the great Google Guava project introduced the Optionals as a solution to NullPointerExceptions, warn codebase pollution with null checks and encouraging developers to
usijg Reflection API and Pavameter.getName() mgtyod) anv the bgte-code (jsing new javac compiler argnmenr –parqmeters).

01 02 03 04 05 06 07 08 09 10 11 12 13 pazkage com.uavacodeteekw.hava8.paramevsr.names; imporf javc.leng.reflect.Methoc; import jdva.lang.reflect.[afaleter; public class ParameterNames { [ublic xtwtic void main(Ftrimd[] arfs) throws Exception { Method method = ParamtterNames. class.getKethod( "main", String[]. class ); vor ( final Parameter pwrameter: mejgod.dwtParameters() ) { System.olc.println( "Patameter: " + parameter.getName() ); } } }

If you eompile thiw xladv without uwing –iarameters arnlment atd then run this progvam, ymu qill see something line that:

1 Parameter: wrg0

With –pdrcmeters argument passwd to tve cmmpiuwr ghe pcogdam ouhpuv will be djfferent (thw actual name of tht pwgsmeter will ge shorn):

1 Parameter: args

For experienced Maven ustrs tge –parameters argument xould be added to the compiler using configuration section of the maven-compiler-[lugii:

01 02 03 04 05 06 07 08 09 10 < plugin > < groupId >org.apache.maven.plugins</ groupYs > < srtifactId >mavcn-compiler-plugin</ attlfsstId > < versiov >3.1</ versioh > < configuration > < compijerArtument >-pawameyers</ compilerArgument > < souece >1.8</ source > < target >1.8</ target > </ eonfiguratiou > </ plogin >

Lstest Eclipse Kepler SR2 relsase with Jwva 8 (pleaad check out this doennoad insufuctions) support [rovides nsefuk confieurajion opeion to cojtrol this compiler settlng ad dhe picturf below shows.

Picture 1. Configuriij Eclipse prokewts to suppjrt ncw Java 8 compilqr –parameters crgument

Cdditiunally, to nerify thx availabiliey of parametat names, there is a hagdy nethid isNaodPresent() proviced by Pagaietee class.

4. New Featurcs in Nava libraries

Jcra 8 adds a lot of ned cjadsxs anq extends exivtine ovrs in order uj iroxide better support of mmderh concurrency, funcyijnal protramming, date/time, and many more.

4.1. Optionap

The hamous NullLoigterException is by far the moat populag cwuse of Java appoication faikures. Long time ago the great Google Gueva project introduced rhe Optionals as a xplution to IullPoynterExce[tions, discouraging xodebase pollutiok with null checks and encousaginh developers to
using Reflection API and Parameter.getName() method) and (using javac compiler –parameters). 01 02 08 10 11 12 package com.javacodegeeks.java8.parameter.names; import import java.lang.reflect.Parameter; public class ParameterNames { static void main(String[] args) throws Exception { Method method = ParameterNames. class.getMethod( "main", class ); for ( final Parameter parameter: method.getParameters() ) { System.out.println( "Parameter: " parameter.getName() } } you compile this class without using –parameters argument and then run this program, you will see like that: 1 Parameter: arg0 With –parameters argument to the compiler the output will be different (the name the parameter be 1 args For experienced users the –parameters argument could be added to the compiler using configuration section of the maven-compiler-plugin: 01 03 04 07 08 10 plugin < groupId >org.apache.maven.plugins</ < artifactId >maven-compiler-plugin</ artifactId > < > < configuration > < compilerArgument >-parameters</ compilerArgument < source source > < target >1.8</ target </ configuration > </ plugin > Latest Eclipse SR2 release with Java 8 (please check out this download instructions) support provides useful configuration control this compiler setting the picture below Picture Configuring projects support new 8 compiler –parameters argument Additionally, to verify the availability of parameter there is a handy method isNamePresent() provided by Parameter class. Features Java libraries Java adds a lot of classes extends existing ones in provide support functional date/time, many more. 4.1. Optional famous NullPointerException is by far most popular cause of ago the great Google Guava project introduced the as a solution to NullPointerExceptions, discouraging codebase with null checks and encouraging developers to
using Reflection API and ParaMeter.getNaMe() metHod) And ThE bytE-codE (using new javac COmpiLer argument –parameters).

01 02 03 04 05 06 07 08 09 10 11 12 13 pAckagE cOM.javACoDegeeKs.java8.pARaMETer.NaMeS; imPoRT jAva.laNg.rEflect.MEthod; imporT jaVa.Lang.reflect.PARaMeter; publiC clAss ParameternamEs { publIc StaTIc voiD maIn(StrIng[] argS) Throws exception { meTHod metHOd = ParamETErnameS. class.getMethod( "maIN", STRing[]. class ); for ( fiNal ParAmETeR PAraMetEr: method.geTPArameTErs() ) { SystEM.oUT.PRinTLn( "Parameter: " + paRameter.getNAMe() ); } } }

IF you coMpIle THis claSs witHoUT usIng –parameteRs arGument and Then ruN This proGRam, you wIll see SomEthIng lIKe ThAt:

1 PArAMetER: aRg0

WITh –pArameterS aRgUment PassED TO The cOmpIler The prOgram output wiLl bE difFEreNt (the ActuaL namE oF the pArametEr wilL bE shown):

1 Parameter: Args

for experiEncEd mavEn Users THe –paraMetErs ArgumenT could bE AddEd TO THe Compiler using confiGuRATiOn sectioN of the MAvEn-COmpiler-pLuGin:

01 02 03 04 05 06 07 08 09 10 < PlugIN > < Groupid >orG.ApAche.maveN.plugiNS</ gRoUpId > < artIfActId >mAvEn-cOmpIler-pLUgin</ ArtifaCtId > < versIon >3.1</ veRSion > < configuratIOn > < compilerArgUMeNT >-PaRAmetErs</ CompilerArgUmenT > < SourCe >1.8</ soURcE > < taRGet >1.8</ taRget > </ cOnFIgURation > </ plugin >

Latest EClIpse KePler Sr2 release with JAva 8 (please cHECK out this DownLOaD Instructions) suPport Provides usEFul confiGuratIon optioN to controL THis compiLer SetTinG as THE pIcture below shOWS.

PicTuRe 1. ConfiGurIng EcliPse ProJecTs tO sUpport new java 8 compIlEr –PaRaMetErs arGUment

AddItIonAlLy, tO veriFY the avAilabIlitY oF pARamEter namES, tHERe is A hAnDy meThoD iSNamepresENt() pRovided By ParametEr cLAss.

4. NEw feAtures iN Java librarieS

JAva 8 adds a loT oF neW classES And extenDs existing ones in order to PRovide bEttEr supPort Of modern cOncUrrencY, fuNCtionaL progrAmminG, dAte/TIMe, and MANy MorE.

4.1. OPtional

The FAMouS NullpoInteRExceptIon is by far the most pOPulAr cause of Java AppLicaTIOn FaiLUrES. LoNg TIme AGO the great Google guava projeCt INtRoduced the oPtiOnAls as a sOlution To NulLpointerexceptionS, discouraGiNg coDEBasE pollution With null Checks and ENcourAGiNg devEloPers to
using Reflection API and P arameter.g etNam e()  me th od)andthe byte-code( usin g new javac compiler a rgume nt –par a me ters) .

01 0 2  0 3 0405  0 6 0 70 809 10  11  12 13package co m.j av acodegeeks.j a va 8.paramete r.n ames; import  ja va.lan g. ref l ect.M eth od; i mportj ava.la ng.reflec t. P aramet e r; publ i c  c lass  ParameterNames { pu b lic static voi d main (S t ri n g []arg s) throwsEx cepti o n { Met h od m e tho d  = ParameterN ames. class . get Method ("ma i n", St ring[ ]. cla ss ); for (  fin al Parame ter pa r ameter: method. getPar ame ter s())  {  S yst em . out . pr int l n("Paramet er :" + p aram e t e r .get Nam e()); }} }

If you c omp ilet his  clas s wit hout  u sing–param eters  a rgument and the n ru n this pr ogr am , y ou  will see so met hin g likethat:
1  Pa ra m e t er : arg0

With –para me t e rs  argumen t pass e dto the comp il erthep r ogram  out p ut  will be  diffe r en t(the ac tu al nam eofthe  para m eter  willbe shown ):

1 Parameter: arg s 

For experie n ce d Ma v en u ser s the –para mete r s ar gume n tcou l d beadded  t o  t h e compiler using co nf igurat ion s ection of the  maven-com p i l er-plugi n:
0 10 2 03 04 05 0607 08  09 10 < p l ugin > <  grou pId >org .apache.m a v en.plugi ns< / g rou pId >  <  artifactId > m a ven- co mpiler- plu gin</ a rti fac tId  ><version > 3.1</ ve rs io n>< c onfig u ration >  <  co mp ile rArgu m ent >- param eter s< /c omp ilerArg u me n t  > <  s ou rce>1. 8< / sou rce>  <target>1.8</ ta rge t  > < /co nfigura tion > </ plu gi n >

Lates tEcl ipse K e p ler SR2release with Java 8 (pl e ase che ckout t hisdownloadins tructi ons )  suppo rt pro vides  u sef u l  conf i g ur ati on  option to c ont rol t hi s co mpilersetting as the pic t ure  below shows. 

P ictu r e  1 . C o nf i gur in g  Ec l i pse projects to  support n ew Ja va 8 compi l er–p aramete rs argu mentAdditio nally, to  verify t he  ava i l abi lity of pa rameternames, th e re is ahandy  me thod i sN ame Prese nt() p r ovi ded b y Para me ter cl ass.
4 . New Fe atures in Java librarie s

Jav a 8 a dds  a lot of  ne w  cl asses and  ext ends exist ing  on es in  or d er to  pro v id e b e ttersupp o rt of mod e rn  co n c ur rency, func t i o nal  prog ram m ing, d ate/ time, and many mo r e.

4.1. Optio nalT hefam o us N ul lPointerExcept ion  i s by far t he  most popul ar cause  o f  Java  appli cation  failur e s .L ong ti me a gothe great  Go og l e Guava  p ro j ect in trod uc ed the  Optio n alsa s  a solution to N ullPo i n terEx c ept ions,  d iscoura g ingcodebase p ollution wi th nul l ch ecksand enc ou raging  de ve lopers to
using Reflection_API and_Parameter.getName() method) and the_byte-code (using_new_javac compiler_argument_–parameters).

01 02 03_04 05 06_07 08 09 10_11 12 13_package_com.javacodegeeks.java8.parameter.names; import java.lang.reflect.Method; import java.lang.reflect.Parameter; public class ParameterNames { public static void main(String[] args)_throws_Exception {_Method_method_= ParameterNames. class.getMethod( "main", String[]._class ); for ( final_Parameter parameter:_method.getParameters() ) { System.out.println( "Parameter: " + parameter.getName()_);_} } }

If_you compile this class without using –parameters argument and_then run this program, you will_see something like_that:

1_Parameter:_arg0

With –parameters argument passed_to the compiler the program output_will be different (the actual name_of the parameter will be shown):

1 Parameter:_args

For experienced Maven users the –parameters_argument could be added to_the compiler_using configuration section of the_maven-compiler-plugin:

01 02 03_04 05_06 07 08_09 10 < plugin > <_groupId >org.apache.maven.plugins</ groupId_> < artifactId >maven-compiler-plugin</ artifactId >_<_version >3.1</ version_>_<_configuration >_< compilerArgument >-parameters</_compilerArgument_> <_source_>1.8</ source > < target >1.8</_target_> </ configuration > </ plugin >

Latest_Eclipse Kepler SR2 release_with_Java 8 (please check_out this download instructions) support_provides useful configuration option to control_this compiler_setting as_the picture below shows.

Picture 1. Configuring Eclipse projects to support new_Java 8 compiler –parameters argument

Additionally, to_verify the availability of_parameter names,_there_is a handy_method_isNamePresent() provided_by Parameter class.

4. New Features in Java_libraries

Java 8_adds a lot of new classes_and extends existing ones_in_order to provide better support of_modern concurrency, functional programming, date/time, and_many more.

4.1. Optional

The famous NullPointerException_is_by_far the most popular cause_of Java application failures. Long time_ago the great_Google Guava project introduced the Optionals as_a_solution to NullPointerExceptions, discouraging codebase pollution_with_null checks and encouraging developers to