Java Array Combine combine(Object[] objects, String glue)

Here you can find the source of combine(Object[] objects, String glue)

Description

combine

License

Open Source License

Declaration

public static String combine(Object[] objects, String glue) 

Method Source Code

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

public class Main {
    public static String combine(Object[] objects, String glue) {
        int l = objects.length;
        int m = l - 1;
        int x;//from   w w w . j  ava 2 s.  c  o  m

        if (l == 0) {
            return null;
        }

        StringBuilder r = new StringBuilder();

        for (x = 0; x < m; x++) {
            r.append(objects[x]).append(glue);
        }
        r.append(objects[x]);
        return r.toString();
    }
}

Related

  1. combine(int size, Object[]... arrays)
  2. combine(int[][] arr, int[] terms)
  3. combine(Object[] array1, Object[] array2, Object[] combinedArray)
  4. combine(Object[] first, Object[] last)
  5. combineAlpha(float[] partsAlpha, int partsN)
  6. combineArrays(final Object[] array1, final Object[] array2, final Object[] targetArray)
  7. combineArrays(float[]... arrays)
  8. combineByteArray(byte[] one, byte[] two)