DEV Community

lou
lou

Posted on • Updated on

Lambda en Java bdarija

Lambda hia wahd te3bir li kaymtel wahd ljoz2 dial lcode, had lcode kayakhod paramètre o kayrejee lik wahd natija.
Btali had lambda ra f7alha f7al les méthodes li mwalfin elihom walakin lambda makathtajch smia 3la 3ks les méthodes lakhrin.

(argument) -> {traitement}  

(argument1, argument2) -> {traitement}  
Enter fullscreen mode Exit fullscreen mode

Expression Lambda mkowan mn 3 lhwayj:

  1. dakchi li qbel mn sehm : hna kaneetiwha les arguments, mli makaykonuch les arguments kaybqaw les parenthese khawyin

() -> {traitement}

  1. sehm -> : hada symbole li kaylseq les arguments btraitement

  2. traitement: hna fin kayn dakchi li baghin mn lambda dir

linaftarid bli lgharad dialna howa d'implementer l'interface Personne et d'afficher Salam

Image description

Blama nste3mlo Lambda nqdro nkhedmo bclasse anonyme:

Image description

Had lmerra ghankhdem b lambda :

Image description

natija flekhr
Image description

had lmital kayakhod 1 argument:

Image description
resultat
Image description

Had laminal kayakhod bof dial les arguments

Image description
resultat Image description

Top comments (0)