File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change 33public class Exercise {
44
55 public static void main (String [] args ) {
6- BookCollection collection = new BookCollection (new HashMap <>());
6+ BookCollection collection = new BookCollection (new HashMap <>());
77
88 try {
99 collection .addAuthor (new Author ("Stephen King" ));
@@ -21,7 +21,10 @@ public static void main(String[] args) {
2121 collection .addBook (new Author ("George RR Martin" ), new Book ("Das Lied von Eis und Feuer 5" ));
2222 collection .addBook (new Author ("George RR Martin" ), new Book ("Das Lied von Eis und Feuer 6" ));
2323
24- System .out .println (collection .getBookByTitle ("Das Lied von Eis und Feuer 5" ));
25- System .out .println (collection .getMostDiligentAuthor ());
24+ collection .getBookByTitle ("Das Lied von Eis und Feuer 5" ).ifPresentOrElse (System .out ::println ,
25+ () -> System .out .println ("Das gesuchte Buch ist nicht vorhanden" ));
26+ collection .getMostDiligentAuthor ().ifPresentOrElse (System .out ::println ,
27+ () -> System .out .println ("Es ist kein entsprechender Autor vorhanden" ));
28+
2629 }
2730}
You can’t perform that action at this time.
0 commit comments