3.用迭代器遍历集合时 ,创建新对象
@Override
public void searchStoreAccount() {
List<Account> accountList = new ArrayList<Account>();
accountList=accountDaoImpl.getStoreAccount(psid);
Iterator<Account> iterator=accountList.iterator();
System.out.println("------店铺的交易记录如下------");
System.out.println("交易类型t宠物编号t价格");
while(iterator.hasNext()) {
Account account = new Account();
account=iterator.next();
System.out.println(
(account.getDeal_type()==1?"售卖宠物":"购买宠物")+"t"+account.getPet_id()+"t"+account.getPrice());
}
}
4.三目运算符的