Hello.  I'm running a server and have added a minigame.  whenever the game is about to start.. it calls onStart() first. Now I get ConcurrentModificationException on this line:  for(Player p : waiting) {   And here is the method:      public void onStart() {     trawler.players.clear();     for(Player p : waiting) {         if(!boat.playerInArea(p)) {             waiting.remove(p);         }     }      for(Player p : waiting) {         trawler.players.add(p);     }      trawler.start();     waiting.clear(); }   if you need the classes, here they are:  TrawlerWaitingRoom.java:  package server.model.minigames.trawler;  import server.model.players.Location; import server.model.players.Player;  public class TrawlerWaitingRoom extends WaitingRoom { private Trawler trawler; //private Location boat = new Location(2668,2674,3165,3185); private Location boat = new Location(2808, 2811,3415,3425);   public TrawlerWaitingRoom(Trawler trawler) {     super(1, 2);     this.trawler = trawler; }  @Override public boolean startGame() {     if(trawler.inProgress()) {         return false;     }     return true; }  @Override public void onStart() {     trawler.players.clear();     for(Player p : waiting) {         if(!boat.playerInArea(p)) {             waiting.remove(p);         }     }      for(Player p : waiting) {         trawler.players.add(p);     }      trawler.start();     waiting.clear(); }  @Override public void onLeave(Player p) {     p.asClient().getPA().movePlayer(2804, 3421, 0);     //p.asClient().getPA().movePlayer(2676, 3170, 0); }  @Override public void onJoin(Player p) {     p.asClient().getPA().movePlayer(2808, 3421, 1);     //p.asClient().getPA().movePlayer(2672, 3170, 1);     if(!isActive()) {         p.asClient().sendMessage(trawler.getGameTime() == 0 ? "The trawler will be returning in less than a minute!" : "The trawler will return in "+trawler.getGameTime() + (trawler.getGameTime() == 1 ? " minute" : " minutes")+"!");     } else {         p.asClient().sendMessage(getTimeRemaining() == 0 ? "The trawler will be leaving in less than a minute!" : "The trawler will leave in "+ getTimeRemaining() + (getTimeRemaining() == 1 ? " minute" : " minutes")+"!");     } }  @Override public Location getLocation() {     return boat; }  @Override public void onTimeChange() {     for(Player p : waiting) {         if(!isActive()) {             p.asClient().sendMessage(trawler.getGameTime() == 0 ? "The trawler will be returning in less than a minute!" : "The trawler will return in "+trawler.getGameTime() + (trawler.getGameTime() == 1 ? " minute" : " minutes")+"!");         } else {             p.asClient().sendMessage(getTimeRemaining() == 0 ? "The trawler will be leaving in less than a minute!" : "The trawler will leave in "+ getTimeRemaining() + (getTimeRemaining() == 1 ? " minute" : " minutes")+"!");         }     } }  @Override public boolean canStart() {     if(trawler.inProgress()) {         return false;     }     if(waiting.size() &lt; minimumPlayers) {         return false;     }     return true; }   }  GroupMinigame.java:  package server.model.minigames.trawler;  import server.model.minigames.trawler.WaitingRoom;  public abstract class GroupMinigame {  public abstract WaitingRoom getWaitingRoom();  public abstract String getWaitingRoomMessage(); }   WaitingRoom.java:   Trawler.java:   Thanks in advance!
We all know you can't do the following because of ConcurrentModificationException:  for (Object i : l) {     if (condition(i)) {         l.remove(i);     } }   But this apparently works sometimes, but not always. Here's some specific code:  public static void main(String[] args) {     Collection&lt;Integer&gt; l = new ArrayList&lt;&gt;();      for (int i = 0; i &lt; 10; ++i) {         l.add(4);         l.add(5);         l.add(6);     }      for (int i : l) {         if (i == 5) {             l.remove(i);         }     }      System.out.println(l); }   This, of course, results in:  Exception in thread "main" java.util.ConcurrentModificationException   Even though multiple threads aren't doing it. Anyway.  What's the best solution to this problem? How can I remove an item from the collection in a loop without throwing this exception?  I'm also using an arbitrary Collection here, not necessarily an ArrayList, so you can't rely on get.
What constitutes a legal block in volleyball in regard to it not counting as the first hit? Today in a match the setter set the ball too low for me to spike it, so I just dinked it over.  The bottom of the ball was lower than the top of the net at the point where I made contact.  When the defender made contact, again, the bottom of the ball was lower than the top of the net (the top of the ball was over the top of the net though).  I felt that this wasn't technically a block and that he shouldn't have been allowed to hit it a second time, but I wasn't sure so I just let it go.  Was this a legal block or should it have been our point when he hit it a second time in a row?  Edit:  I don't think I was clear about the part where, after I hit the ball, the ball travelled over the net onto the other team's side of the court.  The other player did not reach over the net so there is no issue there.  It's just an issue of whether or not their first contact was a block or a hit.  I believe it was not a block but I can't find a specific ruling to address it. I need to show that $$ \int\limits_1^{\infty}x^\alpha\sin(x^\beta)dx $$ converges if and only if $\alpha + 1 &lt; \beta$. I used substitution and integration to get $$ \lim\limits_{t\to\infty}\int\limits_1^tx^\alpha\sin(x^\beta)dx \overset{u = x^\beta}{\underset{du = \beta x^{\beta-1}}{=} }\lim\limits_{t\to\infty}\left(\frac{1}{\beta}\int\limits_1^{t^\beta}u^{\frac{\alpha + 1 - \beta}{\beta}}\sin{u}du\right) $$ If $\alpha + 1 -\beta &lt; 0$, then we have a product if a function with bounded anti-derivative and a differentiable decreasing function which tend to 0, and from Dirichlet's criterion, the integral converges.   For the converse, I used integration by parts $$  = \frac{1}{\beta}\lim\limits_{t\to\infty}\left(\left.-u^{\frac{\alpha + 1-\beta}{\beta}}\cos{u}\right|_1^{t^\beta} + \frac{\alpha+1-\beta}{\beta}\int\limits_1^{t^\beta}u^{\frac{\alpha + 1-2\beta}{\beta}}\cos{u}du\right) $$ For $\alpha + 1 -\beta\geq 0$, I get that the first term indeed diverges, but this is not enough to show total divergence. How can one show it? SQL Join Differences What's difference between inner join and outer join (left join,right join), and which has the best performance of them?  Thanks! Is there a shortcut for switching between these three modes? Which rationals can be written as the sum of two rational squares? Which rational numbers can be written as the sum of two rational squares?  That is, for which rational numbers $a$, are there rational numbers $x$ and $y$ such that $a = x^2 + y^2$.  It is a famous theorem that if an integer can be written as the sum of two rational squares then it can be written as the sum of two integral squares, and then the solution is the famous one by Fermat, but I didn't find anything about the general case. Given a number, how do I discover in what table and column it could be found within? I don't care if it's fast, it just needs to work. Attributive nouns vs. of-genitive Java error: Implicit super constructor is undefined for default constructor Custom function won't refresh as inputs are changed I was really happy when I heard that HoTD would be continued. And even happier when the first new chapter actually came. but now after several months of waiting there still has been no other chapter. So my question is, has HoTD gone on hiatus again ? Google Chrome won't install on 17.04 I had to remove Chrome to have enough space to upgrade from 16.10 to 17.04.  I downloaded the latest version from Google.  But when it opens in the Ubuntu Software Manager, and I click on "Install", nothing happens. I have defined my own custom vim file type with highlighting etc.  I would like to open it using the terminal based vim when I double click on it.  I am using mac os x.  Any pointers on how to start on this? Historical reason behind different line ending at different platforms Why did DOS/Windows and Mac decide to use \r\n and \r for line ending instead of \n? Was it just a result of trying to be "different" from Unix?  And now that Mac OS X is Unix (-like), did Apple switch to \n from \r? Possible to get type of an aliased type in c#? Type.GetType("System.String")   Is there a lookup for the aliases available somewhere?  Type.GetType("string")   returns null. Where can I find a repository for older unsupported releases? Why does my DIY "solar panel circuit" show battery voltage and not solar panel voltage? E.g.: If your Gmail ID is abc.xyz@gmail.com, it considers this the same as abcxyz@gmail.com.  Why is this so? Aliased edge around light source in cycles Often when a mesh light is visible in the camera, the edges are not anti-aliased.  No matter how many samples I do, the lamp border always looks jagged and pixelated.  Is this a rendering error? How can I get around this issue?    And zoomed in 4x: Is there any advantage to using pedal straps over clipless pedals? What does Fermi level in the band gap mean? What does it mean that the  for some semiconductors lie in the band gap?  Is Fermi level definition different from what is know as usual?  We define the Fermi level as the highest level of energy which is occupied by electrons.  Then what is missing here?