Java Array Merge mergeArray(T[] objs, String concatenator)

Here you can find the source of mergeArray(T[] objs, String concatenator)

Description

merge Array

License

Apache License

Declaration

public static <T> String mergeArray(T[] objs, String concatenator) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static <T> String mergeArray(T[] objs, String concatenator) {
        StringBuilder sb = new StringBuilder();
        for (T obj : objs) {
            sb.append(obj).append(concatenator);
        }/* w ww .  ja  v a2s  . co  m*/
        return objs.length == 0 ? "" : sb.substring(0, sb.length() - concatenator.length());
    }
}

Related

  1. mergeAndOrderArray(int[] arrA, int[] arrB)
  2. mergeArgs(String[] args)
  3. mergeArray(byte[] arr1, byte[] arr2)
  4. mergeArray(final Object[] dest, final Object[]... arrays)
  5. mergeArray(String[] a, String[] b)
  6. mergeArrayIntoString(final Object[] array, String middleDelimiter, String lastDelimiter)
  7. mergeArrayObject(Object[] buf1, Object[] buf2)
  8. mergeArrays(byte[] buf1, byte[] buf2)
  9. mergeArrays(byte[] first, byte[]... more)