Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void addItem(Item item, int count) throws ItemOutOfStockException {
- if (count > 10) throw new ItemOutOfStockException(item);
- for (int i = 0; i < items.size(); i++) //
- if (items.contains(item))
- items.remove(items.indexOf(item));
- for (int i = 0; i < count; i++)
- items.add(item);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement