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 3
3
public class Exercise {
4
4
5
5
public static void main (String [] args ) {
6
- BookCollection collection = new BookCollection (new HashMap <>());
6
+ BookCollection collection = new BookCollection (new HashMap <>());
7
7
8
8
try {
9
9
collection .addAuthor (new Author ("Stephen King" ));
@@ -21,7 +21,10 @@ public static void main(String[] args) {
21
21
collection .addBook (new Author ("George RR Martin" ), new Book ("Das Lied von Eis und Feuer 5" ));
22
22
collection .addBook (new Author ("George RR Martin" ), new Book ("Das Lied von Eis und Feuer 6" ));
23
23
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
+
26
29
}
27
30
}
You can’t perform that action at this time.
0 commit comments