Java Array Merge merge(T[]... many)

Here you can find the source of merge(T[]... many)

Description

merge

License

Open Source License

Declaration

public static <T> List<T> merge(T[]... many) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.util.*;

public class Main {
    public static <T> List<T> merge(List<T>... many) {
        ArrayList<T> ret = new ArrayList();
        for (List<T> list : many) {
            if (list != null) {
                for (T val : list) {
                    if (!ret.contains(val)) {
                        ret.add(val);
                    }/*from   w ww  . j  a v a  2s.  c  o  m*/
                }
            }
        }
        ret.trimToSize();
        return ret;
    }

    public static <T> List<T> merge(T[]... many) {
        ArrayList<T> ret = new ArrayList();
        for (T[] list : many) {
            if (list != null) {
                for (T val : list) {
                    if (!ret.contains(val)) {
                        ret.add(val);
                    }
                }
            }
        }
        ret.trimToSize();
        return ret;
    }
}

Related

  1. merge(T[] array1, T[] array2)
  2. merge(T[] first, T[] second)
  3. merge(T[] first, T[] second)
  4. merge(T[] left, T... right)
  5. merge(T[]... arrays)
  6. merge2TablesWithoutDup(String[] t1, String[] t2)
  7. mergeAndOrderArray(int[] arrA, int[] arrB)
  8. mergeArgs(String[] args)
  9. mergeArray(byte[] arr1, byte[] arr2)