Vector ArrayIndexOutOfBounds
<p>I'm having an ArrayIndexOutofBounds exception with the following code.
The exception is thrown at the line where <code> Node nodeJ = vect.get(j) </code></p>

<p>but it does not make sense to me since j is definitely smaller than i and <code> Node nodeI = vect.get(i) </code> does not throw any exception.</p>

<p>any help is appreciated.</p>

<p><code>
public static Vector join(Vector vect) throws ItemNotFoundException {</p>

<pre><code>    Vector&lt;Node&gt; remain = vect;
    for (int i = 1; i &lt; vect.size(); i++) {
        Node nodeI = vect.get(i);
        for (int j = 0; j &lt; i; j++) {//traverse the nodes before nodeI
            Node nodeJ = vect.get(j);

            if (nodeI.getChild1().getSeq().equals(nodeJ.getSeq())) {
                nodeI.removeChild(nodeJ);
                nodeI.setChild(nodeJ);
                remain.remove(j);
            }
            if (nodeI.getChild2().getSeq().equals(nodeJ.getSeq())) {
                nodeI.removeChild(nodeJ);
                nodeI.setChild(nodeJ);
                remain.remove(j);
            }
        }
    }
    return remain;
}
</code></pre>

<p></code></p>
