Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- public class Library{
- public Library(){
- }
- public void getFinishedBooks(HashMap<String, Boolean> library){
- if (library.size() < 1){
- System.out.println("Error the HashMap is empty");
- }
- else {
- for (String book : library.keySet()){
- if (library.get(book) == true){
- System.out.println (book);
- }
- }
- }
- }
- public static void main(String[] args)
- {
- HashMap<String, Boolean> myBooks = new HashMap<String, Boolean>();
- myBooks.put("Road Down the Funnel", true);
- myBooks.put("Rat: A Biology", false);
- myBooks.put("TimeIn", true);
- myBooks.put("3D Food Printing", false);
- Library myLibrary = new Library();
- myLibrary.getFinishedBooks(myBooks);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement