public List<AccountPO> search(String key) throws RemoteException { // TODO List<AccountPO> list = new ArrayList<AccountPO>(); // 符合该关键字的po都加载到list里面 for (AccountPO po : accounts) if (po.getName().contains(key)) list.add(po); return list; }
private boolean update() throws RemoteException { try { FileWriter fw = new FileWriter(file); fw.write(""); System.out.println(accounts.size()); for (AccountPO po : accounts) { // 将列表中的数据再一次的更新到Account.txt文件中去 fw.append(po.getName() + " " + po.getAccountID() + " " + po.getBalance() + "\n"); fw.flush(); } fw.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } return true; }