Android String Array Join join(String separator, Object... texts)

Here you can find the source of join(String separator, Object... texts)

Description

join

License

BSD License

Declaration

public static String join(String separator, Object... texts) 

Method Source Code

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

import java.util.List;

public class Main {
    public static String join(List<?> texts, String separator) {
        StringBuilder result = new StringBuilder();
        for (Object text : texts) {
            result.append(text);// w w  w.jav a 2  s.co  m
            result.append(separator);
        }
        return result.toString();
    }

    public static String join(String separator, Object... texts) {
        StringBuilder result = new StringBuilder();
        boolean isFirst = true;
        for (Object text : texts) {
            if (isFirst) {
                result.append(separator);
                isFirst = false;
            }
            result.append(text);
        }
        return result.toString();
    }
}

Related

  1. join(String[] s, String glue)
  2. join(String delimiter, String[] strings)
  3. join(int[] arr, String delimiter)
  4. join(String[] parts, String delimiter)
  5. join(String delimiter, Object... chunks)
  6. join(String[] track)
  7. join(String delimiter, String[] array)
  8. join(String[] strArray, String separator)
  9. join(String[] array, String separator)