Why does HashSet say it does not contain this Object?
<p>I am trying to print "Contains", however, the HashSet is not detecting the Integer[] value.  Does it have to do with it being Passed By Reference?  How can I overcome this if I do not want to pass the actual Integer[] object into the method's arguments?</p>

<pre><code>import java.util.*;

public class passByReference2{
    public static void method(HashSet&lt;Integer[]&gt; visited){
        Integer[] n = {1, 2};
        if (visited.contains(n)){
            System.out.println("Contains");
        }
    }

    public static void main(String[]args){
        HashSet&lt;Integer[]&gt; visited = new HashSet&lt;Integer[]&gt;();
        Integer[]v = {1, 2};
        visited.add(v);
        method(visited);
    }


}
</code></pre>