Java tutorial
//package com.java2s; import java.util.*; public class Main { public final static <T> List<T> unicon(List<T> list1, List<T> list2) { List<T> list = new ArrayList(list1.size() + list2.size()); list.addAll(list1); list.addAll(list2); return list; } public final static <T> Set<T> unicon(Set<T> set1, Set<T> set2) { Set<T> set = new HashSet<>(set1.size() + set2.size()); set = set1; set.addAll(set2); return set; } public final static <T> Queue<T> unicon(Queue<T> queue1, Queue<T> queue2) { Queue queue = new LinkedList(); queue.addAll(queue1); queue.addAll(queue2); return queue; } public final static <K, V> Map<K, V> unicon(Map<K, V> map1, Map<K, V> map2) { Map<K, V> map = new HashMap<>(map1.size() + map2.size()); map.putAll(map1); map.putAll(map2); return map; } }