Removing a subarraylist from mainarraylist in android
<p>I'm using Android 2.3.3. I have a <code>mainArrayList&lt;String&gt;</code>, and a <code>subArrayList&lt;String&gt;</code> which has content that is part of <code>mainArrayList&lt;String&gt;</code>. I wish to remove this <code>subArrayList&lt;String&gt;</code> from the <code>mainArrayList&lt;String&gt;</code>.</p>

<p>How do I do it?</p>

<p>I tried using <code>alMainArrayList.remove(alSubArrayList)</code>. But it doesn't work. Can someone help me?</p>

<p>Ex:</p>

<pre><code>alMainArrayList&lt;String&gt; = [1,+,(,2,*,(,3,+,4,),),)]
alSubArrayList&lt;String&gt; = [(,3,+,4,)]
</code></pre>

<p>For more information, I am developing a calculator app, where in i have the given expression in a <code>ArrayList&lt;String&gt; alMainArrayList</code>. After performing the evaluation of a sub expression, I wish to remove it from the alMainArrayList and then insert the result into it at the specified index. The code complies.</p>

<p>The problem is, the subexpression, which i have in alSubArrayList doesn't get deleted, when i use <code>alMainArrayList.remove(alSubArrayList)</code> or even <code>alMainArrayList.removeAll(alSubArrayList)</code>. </p>

<p>It's a loop, and so the result gets added at the specified index (without first deleting the subArrayList) and the loop enters into infinite loop.</p>

<p>To provide the code snippet, it's a bit hard. They are bits of pieces here and there. So, if someone understood what i wanted to say, please help me.</p>
