List of utility methods to do ArrayList Union
ArrayList | union(ArrayList union ArrayList<String> result = new ArrayList<String>(); result.addAll(list1); result.addAll(list2); Collections.sort(result); return distinct(result); |
ArrayList | Union(ArrayList Finds the union of two lists of String objects Set union = new HashSet(list1); union.addAll(new HashSet(list2)); return new ArrayList(union); |
ArrayList | union(ArrayList union ArrayList<T> result = new ArrayList<T>(); for (T t : a) if (!result.contains(t)) result.add(t); for (T t : b) if (!result.contains(t)) result.add(t); return result; ... |
ArrayList | unionSets(ArrayList union two sets s1 and s2 if (s2 == null) { return s1; for (Integer i : s2) { if (!s1.contains(i)) { s1.add(i); return s1; |