@Override public synchronized boolean add(QueueObject to) { if (to == null) return false; playerSize += to.getNumPlayers(); teamSize += to.getTeams().size(); return super.add(to); }
@Override public boolean remove(QueueObject queueObject) { if (super.remove(queueObject)) { playerSize -= queueObject.getNumPlayers(); teamSize -= queueObject.getTeams().size(); return true; } return false; }
public synchronized ArenaTeam remove(ArenaTeam team) { Iterator<QueueObject> iter = this.iterator(); while (iter.hasNext()) { QueueObject qo = iter.next(); if (qo.hasTeam(team)) { iter.remove(); playerSize -= qo.getNumPlayers(); teamSize -= qo.getTeams().size(); return team; } } return null; }