Java tutorial
//package com.java2s; import java.util.Arrays; import java.util.List; public class Main { public static <T> List<T> union(T[] viewLocationsSearched, T[] masterLocationsSearched) { // TODO Auto-generated method stub List<T> result = Arrays.asList(viewLocationsSearched); for (T item : masterLocationsSearched) { if (!result.stream().anyMatch(p -> p.equals(item))) { result.add(item); } } return result; } }