Write an implementation of the BookDao interface using the Map data structure. Do not print any messages inside your implementation code and not change the provided code of the classes.
Data Access Object for JDBC
Map-based implementation
Report a typo
Sample Input 1:
0
The Lord of the Rings
1
Pride and Prejudice
10Sample Output 1:
Found Book [id 0, title : The Lord of the Rings]
Not found id 10
Found Book [id 1, title : Pride and Prejudice]
Updated Book [id 1, title : UPDATED]
Deleted id: 1Write a program in Java 17
import java.util.*;
interface BookDao {
void add(Book book);
Book get(int id);
void update(Book book);
void delete(int id);
}
class BookDaoImpl implements BookDao {
private final Map<Integer, Book> books;
public BookDaoImpl() {
this.books = new HashMap<>();
}
@Override
public void add(Book book) {
// write your code here
}
@Override
public Book get(int id) {
// write your code here
}
@Override
public void update(Book book) {
// write your code here
}
@Override
___
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.
Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.