Finding duplicate points within an arraylist of points
<p>I'm trying to delete all the duplicate points within two array lists. Each list is created by finding which country links to which country, if they link then it creates a new point in both arrays at the same time.</p>

<p>The idea is so that I can loop though the size of both arrays (Or size of one) and draw lines between the points.</p>

<p>Problem at the moment is that it's not deleting the points or it deletes them all.</p>

<p>I have the following Arrays</p>

<pre><code>//Different values of course.
Array1 = [Point[1,5]],[Point[1,5]],[Point[1,5]][Point[1,5]]
Array2 = [Point[1,5]],[Point[1,5]],[Point[1,5]][Point[1,5]]
</code></pre>

<p>Here's the code that deletes the duplicate arrays out:</p>

<pre><code>private ArrayList&lt;ArrayList&lt;Point&gt;&gt; checkDuplicatePoints(ArrayList&lt;Point&gt; Array1, ArrayList&lt;Point&gt; Array2)
{
    for(int index1 = 0; index1 &lt; Array1.size(); index1++)
    {
        for(int index2 = 0; index2 &lt; Array2.size(); index2++)
        {
            //So not the same position in the list.
            if(index1 != index2)
            {
                if(
                    Array1.get(index1).x == Array2.get(index2).x &amp;&amp;
                    Array1.get(index1).y == Array2.get(index2).y
                )
                {
                    Array1.remove(index1);
                    Array2.remove(index2);
                    checkDuplicatePoints(Array1, Array2);
                }
            }
        }
    }

    ArrayList&lt;ArrayList&lt;Point&gt;&gt; n2DPointArray = new ArrayList&lt;ArrayList&lt;Point&gt;&gt;();

    n2DPointArray.add(Array1);
    n2DPointArray.add(Array2);

    return n2DPointArray;
}
</code></pre>
