title: How to merge two string arrays with no duplicates?
body: <p>I was able to get the two arrays to sort and merge but I can not figure out how to remove the duplicates. Can someone please help me with this? Here is my code so far:</p>
  <pre class="lang-java prettyprint-override"><code>public class FinalArray {
      public static void main(String[] args) {
          String[] testArray1 = {&quot;coffee&quot;, &quot;tea&quot;, &quot;water&quot;};
          String[] testArray2 = {&quot;lemonade&quot;, &quot;juice&quot;, &quot;water&quot;};
          mergeUniqueValues(testArray1, testArray2);
      }
  
      public static void mergeUniqueValues(String[] arr1, String[] arr2) {
          String[] arr3 = new String[arr1.length + arr2.length];
  
          for (int i = 0; i &lt; arr1.length; i++) {
              arr3[i] = arr1[i];
          }
          for (int i = arr1.length, index = 0; i &lt; arr1.length + arr2.length; i++, index++) {
              arr3[i] = arr2[index];
          }
          Arrays.sort(arr3);
  
          System.out.println(&quot;Your sorted array is: &quot;);
          for (String str : arr3) {
              System.out.println(str);
          }
      }
  }
  </code></pre>