Java Array Join join(String[]... arrays)

Here you can find the source of join(String[]... arrays)

Description

join

License

Open Source License

Declaration

public static String[] join(String[]... arrays) 

Method Source Code

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

public class Main {
    public static String[] join(String[]... arrays) {
        // calculate size of target array
        int size = 0;
        for (String[] array : arrays) {
            size += array.length;//from   w  w w.j  a  va  2 s.  com
        }

        // create list of appropriate size
        java.util.List<String> list = new java.util.ArrayList<String>(size);

        // add arrays
        for (String[] array : arrays) {
            list.addAll(java.util.Arrays.asList(array));
        }

        // create and return final array
        return list.toArray(new String[size]);
    }
}

Related

  1. join(String[] strs)
  2. join(String[] strs, String glue, int start, int end)
  3. join(String[] tokens, String delimiter)
  4. join(String[] tokens, String separator)
  5. join(String[] x)
  6. join(String[]... values)
  7. join(T[] a, T[] b)
  8. join(T[] arr1, T[] arr2)
  9. join(T[] array, String join)