lendlist.java
来自「使用swing做的熟悉控件使用的DEMO」· Java 代码 · 共 47 行
JAVA
47 行
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 + =
减小字号Ctrl + -
显示快捷键?