ConcurrentModificationException thrown without directly looping through collection I have the following code:  // Creates ArrayList with integers 0-9 ArrayList&lt;Integer&gt; intKeys = new ArrayList&lt;Integer&gt;(); for (int x = 0; x &lt; 10; x++) {     intKeys.add(x); }  // Creates iterator with integers 0-9 Iterator&lt;Integer&gt; allKeys = intKeys.iterator();  // Loops 10 times, each time obtaining a key to remove from the ArrayList for (int x = 0; x &lt; 10; x++) {     Integer key = allKeys.next();     intKeys.remove(key); }   I understand that ConcurrentModificationException is thrown if an element of a collection is removed while the collection is being looped over, such as:  for (String key : someCollection) {     someCollection.remove(key);     }   but right now I'm looping over nothing - just an arbitrary number of times. Furthermore, the error line is interestingly Integer key = allKeys.next(); What could be the cause of this exception?
Iterating through a Collection, avoiding ConcurrentModificationException when removing objects in a loop 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 do I if I used "Reset All" or "Erase All Content and Settings" on a jailbroken iOS Device? I recently received an iOS device and it was jailbroken. When I wanted to unjailbreak it, I used "Erase All Content and Settings." The loading screen came on and it has not changed. After rebooting the device, it is now stuck at the Apple logo. What should I do? I'm looking to do a third-party assessment of the false-positive rate of a video classification algorithm. Since I have a lot of video I'm trying to do a power analysis to figure out exactly how much video I need to look through so that it is representative of all the video data at a given confidence interval.  The algorithm flags video sequences that have at least one cat in it, and I'm looking to evaluate the frequency of false positives on a new unlabeled test set. So I have tagged all the video that my algorithm has identified a cat in and now want to sample the tagged video sections and look through them manually to validate my model since looking through all of it would take too long! Note, I'm not looking to refine the model at this point, just assess it.  My null hypothesis is that the FP rate of the sample of video I watch is equal to the FP rate of all the video.   I think I can use this formula to determine the number of video sequences to view:    Here is my question: am I thinking through this formulation correctly? Since my model has a CV false positive rate of ~0.96, I figure I can use that as a reference. Can I use that for the null hypothesis proportion, p0? Or will that be p, the true proportion?    I've been using this online calculator:   I ask because when setting the parameters I have, I'm getting very small sample sizes, like less than 10 sequences to view. That can't be right. $a,b,c$ are real numbers $>0$. If $a+b+c=1$, show that $(a+\frac{1}{a})^2+(b+\frac{1}{b})^2+(c+\frac{1}{c})^2\ge\frac{100}{3}$ Reference undefined in \section with amsbook I have a section that is devoted to the proof of a theorem, and hence I used  \section{Proof of Theorem~\ref{thm}}   Of course, because of the headers that are capitalized, it asks for \ref{THM} when producing the header, and I get an obvious error. What is the proper way to handle such a case? Below is a MWE:  \documentclass{amsbook} \usepackage{lipsum} \newtheorem{thm}{Theorem} \begin{document} \chapter{First Chapter} \section{The Theorem} \begin{thm}[Lipsum Theorem] \label{thm} \lipsum[1] \end{thm} \section{Proof of Theorem~\ref{thm}} \lipsum[1-23] \end{document}   When compiling I get:  LaTeX Warning: Reference `THM' on page 3 undefined on input line 14.   (each time it produces a header), and the header shows     `2. PROOF OF THEOREM ??' When I wanted to download Ubuntu 12.10 from ubuntu.com, I was asked to make a donation. However, there is only a PayPal option to make the payment. But I don't use PayPal. Is there any other option to make the payment? Guess the formula for $\sum\frac 1{(4n-3)(4n+1)}$ and prove by induction How do I disable Dunst and go back to notify-osd? I installed i3, which recommends dunst, but I'm not using i3 at the moment, and the dunst notifications don't really fit with Unity. I'd rather not uninstall dunst totally, since I might want to start using it at some point in the future; is there a way to switch back to notify-osd without uninstalling dunst? Is there a way to disable WAC String for a specific link (ex. Tracking Link) with AMPscript or otherwise? Let $q_1,q_2,q_3,q_4$ be orthonormal vectors in $\mathbb{R}^4$,$z_1,z_2,...,z_6$ orthonormal vectors in $\mathbb{R}^6$ and $A=z_1q_1^T + z_2q_2^T$. Let $q_1,q_2,q_3,q_4$ be orthonormal vectors in $\mathbb{R}^4$,$z_1,z_2,...,z_6$ orthonormal vectors in $\mathbb{R}^6$ and $A=z_1q_1^T + z_2q_2^T$.  a) Find the base and dimension of fundamental subspaces of matrix A  b) Using the results given by a) find the general solution for $Ax - z_1$.  Any hint would be appreciated. Proving surjectivity of $\cos(z)$ and $\sin(z)$ and find all $z : \cos(z) \in \mathbb R$ and all $z: \sin(z) \in \mathbb R$ Proof of when is $A=X^TX$ invertible? Say we have an $n\times m$ matrix $X$. What are the specific properties that $X$ must have so that $A=X^TX$ invertible?  I know that when the rows and columns are independent, then matrix $A$ (which is square) would be invertible and would have a non-zero determinant. However, what confuses me is, what sort of conditions must we have on each row of $X$ such that $A$ would be invertible.   It would be very nice to have a solution of the form:   when $n &gt; m$ then $X$ must have... when $n &lt; m$ then $X$ must have... when $n = m$ then $X$ must have...   I think in the 3rd case we just need $X$ to be invertible but I was unsure of the other two cases. Bookmark panel in Chrome/Chromium like in Firefox How to select (highlight) text in Skype chat without using a mouse? Recently I started learning to use keyboard shortcuts almost for everything I'm doing on the laptop, but soon enough after I started, I bumped into the problem of being unable to highlight (select) simple text in Skype chats.  I did some research and I couldn't find any solution to my problem. Have I missed an already answered question that is the same like mine or if not what solution can you suggest in order to achieve the results I want without touching mouse or touchpad or any cursor moving device? What's the meaning of a dot before a command in shell? While following android eclipse debug tutorial, I encounter following commands.  cd /path/to/android/root  . build/envsetup.sh  lunch 1     make        emulator   My problem is what the dot before build/envsetup.sh means? Show that $f$ is differentiable on $(−1, 1)$. Let $f$ be a function defined on the interval $(−1, 1)$ such that for all $x, y \in (−1, 1)$, $$f(x + y) = \frac{{f(x) + f(y)}}{{1 - f(x)f(y)}}.$$ Suppose that $f$ is differentiable at $x = 0$, show that $f$ is differentiable on $(−1, 1)$.  Need your kind guidance and help. Thanks in advance! I have an excel file with 2 attribute columns, 1-feature info 2-Number of color (RGB) that the current feature should be symbolize. This file file can be joined with the layer using the "feature info" field which is unique (join by attribute table). So i have as attribute the color number attribute for every polygon feature.  How can  i use this this information to symbolize every feature with their attributed color already imported from the excel sheet? How can I wrap text around a bottom-right div? Careers: What does "allows remote" mean? When a posting is marked "allows remote", does it mean work in the office some days, work from home some days?  Or does it mean you could actually live out of town and maybe fly in as needed?  The reason I ask is I'm really interested in public facing software rather than internal/enterprise stuff, and most of that seems to happen in a few very expensive cities.  Given it's so hard to hire in places like SV/NYC, it seems like it could be a good scenario for companies if a developer had a really solid list of accomplishments, but I don't know how many companies think this way. Dual citizenship passports and visas This is about entering the USA. I have   Hungarian citizenship with a 10 year B1/B2 visa in my passport I got before Hungary became part of the VWP. Real soon now, I will become a Canadian citizen (my oath is on April 5th) and will get a passport.   Since I, as a person, have a visa, am I obliged to enter into the USA with that? Or can I just forget it and use my Canadian passport? I know I could do whatever I want if I didn't have a visa but with that in the picture I am unsure.  describes a number of situations but not mine. Where did the "play on realms" option go? My Minecraft app now only has the option of "play" and there is no "play on realms" to be found!  I downloaded - and paid for - the multiplayer app, but there doesn't seem to be a way to get to any realms on that app either.