Java Array Join join(char sep, Object[] array)

Here you can find the source of join(char sep, Object[] array)

Description

join

License

Apache License

Declaration

public static String join(char sep, Object[] array) 

Method Source Code

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

import java.util.*;

public class Main {
    public static String join(char sep, Object[] array) {
        return join(sep, Arrays.asList(array));
    }//from  ww w  .ja va 2 s. com

    public static String join(char sep, Iterable it) {
        String s = "";
        for (Object o : it)
            s += (s.length() == 0 ? "" : sep) + o.toString();
        return s;
    }

    public static <T> T[] join(T[] a, T[] b) {
        T[] res = Arrays.copyOf(a, a.length + b.length);
        System.arraycopy(b, 0, res, a.length, b.length);
        return res;
    }

    public static float[] join(float[] a, float[] b) {
        float[] res = Arrays.copyOf(a, a.length + b.length);
        System.arraycopy(b, 0, res, a.length, b.length);
        return res;
    }

    public static double[] join(double[] a, double[] b) {
        double[] res = Arrays.copyOf(a, a.length + b.length);
        System.arraycopy(b, 0, res, a.length, b.length);
        return res;
    }

    public static String[] toString(long[] dom) {
        String[] result = new String[dom.length];
        for (int i = 0; i < dom.length; i++)
            result[i] = String.valueOf(dom[i]);
        return result;
    }

    public static String[] toString(int[] dom) {
        String[] result = new String[dom.length];
        for (int i = 0; i < dom.length; i++)
            result[i] = String.valueOf(dom[i]);
        return result;
    }
}

Related

  1. arrayJoin(int[] a, int[] b)
  2. arrayJoin(String[] arr, String joinStr)
  3. arrayJoin(String[] array, char with)
  4. arrayJoinToString(Object[] array, CharSequence delim)
  5. join(byte[]... bs)
  6. join(CharSequence separator, String[] strings)
  7. join(CharSequence[] strings, CharSequence separator)
  8. join(final Object[] array)
  9. join(final Object[] array, final char separator)