public MediaCopy findCopyById(String copyId) { Collection listsOfCopies = mediaCopies.values(); for (Iterator i = listsOfCopies.iterator(); i.hasNext(); ) { List copies = (List) i.next(); for (int j = 0; j < copies.size(); j++) { MediaCopy mediaCopy = (MediaCopy) copies.get(j); if (mediaCopy.getId().equals(copyId)) return mediaCopy; } } return null; }
public List findAllLoanReceiptsFor(String patronId) { List receipts = new LinkedList(); Collection copyLists = mediaCopies.values(); for (Iterator i = copyLists.iterator(); i.hasNext(); ) { List copyList = (List) i.next(); for (int j = 0; j < copyList.size(); j++) { MediaCopy mediaCopy = (MediaCopy) copyList.get(j); LoanReceipt receipt = mediaCopy.getLoanReceipt(); if (receipt != null && receipt.getBorrower().getId().equals(patronId)) receipts.add(receipt); } } return receipts; }