title: How to return an array that contains values, which appear in two arrays? And no duplicates
body: <p>I want to pass two arrays of names so that it will return an array containing the names that appear in either or both arrays. The returned array should have no duplicates.</p>
  
  <p>For example, calling <code>MergeNames.uniqueNames(new String[]{'Ava', 'Emma', 'Olivia'}, new String[]{'Olivia', 'Sophia', 'Emma'})</code> should return an array containing Ava, Emma, Olivia, and Sophia in any order.</p>
  
  <p>Need to basically implement the <code>uniqueNames</code> method. Apologies for asking, I am new to Java programming and trying to become a developer by trying coding challenges.</p>
  
  <pre><code>public class MergeNames {
  
      public static String[] uniqueNames(String[] names1, String[] names2) {
          throw new UnsupportedOperationException("Waiting to be implemented.");      
      }
  
      public static void main(String[] args) {
          String[] names1 = new String[] {"Ava", "Emma", "Olivia"};
          String[] names2 = new String[] {"Olivia", "Sophia", "Emma"};
          System.out.println(String.join(", ", MergeNames.uniqueNames(names1, names2))); // should print Ava, Emma, Olivia, Sophia
      }
  }
  </code></pre>
  
  <p>******MY SOLUTION ANY FEEDBACK WELCOME******</p>
  
  <pre><code>import java.util.*;
  
  public class MergeNames {
  
  public static void main(String[] args) {
  
      String[] names1 = new String[] {"Ava", "Emma", "Olivia"};
      String[] names2 = new String[] {"Olivia", "Sophia", "Emma"};
  
      Set&lt;String&gt; mySet1 = new HashSet&lt;String&gt;(Arrays.asList(names1));
      Set&lt;String&gt; mySet2 = new HashSet&lt;String&gt;(Arrays.asList(names2));
  
      Set&lt;String&gt; union = new HashSet&lt;String&gt;(mySet1);
      union.addAll(mySet2);
      System.out.println("Union of the two Sets with no duplicate names : " + union);
  
  }
  }
  </code></pre>
  
  <p>I'm not sure why the uniqueNames function is needed?</p>