⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 borrowerdatabase.java

📁 ssd3的教程 是我们老师给我们的 纯英文 有兴趣的可以
💻 JAVA
字号:
/*!Begin Snippet:file*/
import java.util.*;
import java.text.*;

/**
 * Maintains a collection of {@link Borrower} objects.
 *
 * @author author name
 * @version  1.0.0
 * @see Borrower
 */
public class BorrowerDatabase {

	/* Collection of <code>Borrower</code> objects.*/
	private Vector  borrowers;

	/**
	 * Constructs an empty collection of {@link Borrower}
	 * objects.
	 */
	public BorrowerDatabase()  {

		borrowers = new Vector();
	}

	/**
	 * Adds a {@link Borrower} object to this collection.
	 *
	 * @param borrower  the {@link Borrower} object.
	 */
	public void  addBorrower(Borrower borrower)  {

		borrowers.add(borrower);
	}

	/**
	 * Returns an iterator over the borrowers in this database.
	 *
	 * return  an {@link Iterator}
	 */
	public Iterator  getBorrowersIterator() {

		return borrowers.iterator();
	}

	/**
	 * Returns the {@link Borrower} object with the specified
	 * <code>id</code>.
	 *
	 * @param code  the id of the borrower.
	 * @return  The {@link Borrower} object with the specifed id.
	 *          Returns <code>null</code> if the object with the
	 *          id is not found.
	 */
	public Borrower  getBorrower(String id)  {

		for (Iterator i = getBorrowersIterator(); i.hasNext();) {

			Borrower borrower = (Borrower) i.next();

			if (borrower.getId().equals(id)) {

				return borrower;
			}
		}

		return null;
	}

	/**
	 * Returns the number of {@link Borrower} objects in this collection.
	 *
	 * @return  the number of {@link Borrower} objects in this collection.
	 */
	public int  getNumberOfBorrowers()  {

		return borrowers.size();
	}
}
/*!End Snippet:file*/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -