package model; import java.util.ArrayList; import server.ShoppingException; public class ItemRegister { ArrayList alItems; public ItemRegister() { alItems = new ArrayList(); } public void addItem(ItemVO item) throws ShoppingException { alItems.add(item); } public ItemVO getLastItem() throws ShoppingException { if(alItems.isEmpty()) { throw new ShoppingException("Listen er tom!"); } else { return alItems.get(alItems.size() - 1); } } }