File tree Expand file tree Collapse file tree
java2/functionalprogramming Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -44,13 +44,15 @@ public int compare(Human h1, Human h2) {
4444 }
4545 });
4646 // // Lambda Funktion - Kurze Syntax
47- Collections .sort (employees , (Human h1 , Human h2 ) -> h1 .age () < h2 .age () ? -1 : h1 .age () > h2 .age () ? 1 : 0 );
47+ Collections .sort (
48+ employees , (Human h1 , Human h2 ) -> h1 .age () < h2 .age () ? -1 : h1 .age () > h2 .age () ? 1 : 0 );
4849
4950 // // Lambda Funktion - Kurze Syntax ohne explizite Datentypen
5051 Collections .sort (employees , (h1 , h2 ) -> h1 .age () < h2 .age () ? -1 : h1 .age () > h2 .age () ? 1 : 0 );
5152
5253 // // Lambda Funktion - Als Referenzvariable gespeichert
53- Comparator <Human > ageSorter = (h1 , h2 ) -> h1 .age () < h2 .age () ? -1 : h1 .age () > h2 .age () ? 1 : 0 ;
54+ Comparator <Human > ageSorter =
55+ (h1 , h2 ) -> h1 .age () < h2 .age () ? -1 : h1 .age () > h2 .age () ? 1 : 0 ;
5456 Collections .sort (employees , ageSorter );
5557 }
5658}
You can’t perform that action at this time.
0 commit comments