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