package net.okjsp.poll; import java.util.ArrayList; public class PollService { static ArrayList list = new ArrayList(); public int add(Poll poll) { int newPollId = list.size(); poll.setId(newPollId); list.add(poll); return poll.getId(); } public ArrayList getList() { return list; } public Poll get(int id) { for(Poll poll: list) { if (poll.getId() == id) return poll; } return null; } public int countUp(int pollId, int itemId) { Poll poll = get(pollId); return poll.increment(itemId); } }