Java tutorial
//package com.java2s; import java.util.HashSet; import java.util.Set; public class Main { public static String[] union(String[] arr1, String[] arr2) { Set<String> set = new HashSet<>(); for (String str : arr1) { set.add(str); } for (String str : arr2) { set.add(str); } String[] result = {}; return set.toArray(result); } }