📄 lendlist.java
字号:
package book;import java.util.HashSet;import java.util.Iterator;import java.util.Collection;import java.util.ArrayList;import userexception.*;/*** class LendList*/public class LendList { private static LendList instance; private ArrayList books; //constructor private LendList() { books = new ArrayList(); } //static method to get the instance public synchronized static LendList getInstance() { if(instance == null) instance = new LendList(); return instance; } //add a book to the lendlist public void addBook(Book bk) { books.add(bk); } //remove a book from the lendlist public void removeBook(Book bk) throws BookNotFoundException { int idx = books.indexOf(bk); if(idx != -1) { books.remove(books.indexOf(bk)); }else { throw new BookNotFoundException(); } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -