Update Entity.java

final int entityCount = entities.size(); // this way is not safe for concurrent threads

TODO need to check and other places, like next: final int entityCount = entities.size();