Appends a pair of string to the string buffer, using the separator between
and terminator at the end
@param b the buffer
@param s1 first string
@param s2 second string
@param separator separator string
@param terminator terminator string
177963
public static void appendPair(StringBuffer b, String s1, String s2,
                                  String separator, String terminator) {

        b.append(s1);
        b.append(separator);
        b.append(s2);
        b.append(terminator);
    }
209621
public static String join(Iterator strings, String sep) {
        if (!strings.hasNext())
            return "";

        String start = strings.next().toString();
        if (!strings.hasNext()) // only one, avoid builder
            return start;

        StringBuilder sb = StringUtil.borrowBuilder().append(start);
        while (strings.hasNext()) {
            sb.append(sep);
            sb.append(strings.next());
        }
        return StringUtil.releaseBuilder(sb);
    }
1260117
public void print(String separator, String terminator) {
    for (int i = 0; i < maxColumnLength.size(); i++) {
      maxColumnLength.set(i, (((maxColumnLength.get(i) / TAB_SIZE) + 1) * TAB_SIZE));
    }

    for (int r = 0; r < rows.size(); r++) {
      String[] s = rows.get(r);

      for (int i = 0; i < s.length; i++) {
        out.print(s[i]);

        if (i < s.length - 1) {
          for (int l = (s[i] == null ? 0 : s[i].length()); l < maxColumnLength.get(i); l++) {
            out.print(' ');
          }
        }
      }
      if (separator != null && r < rows.size() - 1) { out.println(separator); } else if (terminator != null
          && r == rows.size() - 1) { out.println(terminator); } else { out.println(); }
    }
  }
432314
public static String concat(String[] array, String separator, int fromIndex, int toIndex) {
    StringBuilder buf = new StringBuilder();
    for (int i = fromIndex; i <= toIndex; i++) {
      if (buf.length() > 0)
        buf.append(separator);
      buf.append(array[i]);
    }
    return buf.toString();
  }
1115447
private static String join(double[] seriesData, String separator) {

    // two or more elements
    StringBuilder sb = new StringBuilder(256); // Java default is 16, probably too small
    sb.append(seriesData[0]);
    for (int i = 1; i < seriesData.length; i++) {

      if (separator != null) {
        sb.append(separator);
      }

      sb.append(seriesData[i]);
    }
    return sb.toString();
  }
914276
public void append(final StringBuffer sb) {
        if (sb == null) {
            return;
        }
        provideCapacity(length + sb.length());
        sb.getChars(0, sb.length(), c, length);
        length += sb.length();
    }
850927
public void show(StringBuffer sb) {
    int start;
    start = span.getStart();
    if (!type.equals(ParserME.TOK_NODE)) {
      sb.append("(");
      sb.append(type +" ");
      //System.out.print(label+" ");
      //System.out.print(head+" ");
      //System.out.print(df.format(prob)+" ");
    }
    for (Iterator i = parts.iterator(); i.hasNext();) {
      Parse c = (Parse) i.next();
      Span s = c.span;
      if (start < s.getStart()) {
        //System.out.println("pre "+start+" "+s.getStart());
        sb.append(text.substring(start, s.getStart()));
      }
      c.show(sb);
      start = s.getEnd();
    }
    sb.append(text.substring(start, span.getEnd()));
    if (!type.equals(ParserME.TOK_NODE)) {
      sb.append(")");
    }
  }
1353045
public void append(final CharArrayBuffer b) {
        if (b == null) {
            return;
        }
        append(b.array,0, b.len);
    }
1368399
public static BasicTagList concat(TagList t1, Tag... t2) {
    return new BasicTagList(Iterables.concat(t1, Arrays.asList(t2)));
  }
264420
public static String join(final Collection<?> collection, final String separator) {
        StringBuffer buffer = new StringBuffer();
        boolean first = true;
        Iterator<?> iter = collection.iterator();
        while (iter.hasNext()) {
            Object next = iter.next();
            if (first) {
                first = false;
            } else {
                buffer.append(separator);
            }
            buffer.append(next);
        }
        return buffer.toString();
    }
892798
public static CodeBlock join(Iterable<CodeBlock> codeBlocks, String separator) {
    return StreamSupport.stream(codeBlocks.spliterator(), false).collect(joining(separator));
  }
278436
private static void appendParam(final OmdbParameters params, final Param key, StringBuilder sb) {
        if (params.has(key)) {
            sb.append(DELIMITER_SUBSEQUENT).append(key.getValue()).append(params.get(key));
        }
    }
368781
public static String combine(String str1, String str2, String separator) {

        if (separator == null || separator.isEmpty()) {
            return str1 == null ? str2 : str1.concat(str2);
        }
        if (str1 == null)
            str1 = "";
        if (str2 == null)
            str2 = "";

        StringBuilder builder = new StringBuilder();
        if (str1.endsWith(separator)) {
            builder.append(str1.substring(0, str1.length() - separator.length()));
        } else {
            builder.append(str1);
        }
        builder.append(separator);

        if (str2.startsWith(separator)) {
            builder.append(str2.substring(separator.length()));
        } else {
            builder.append(str2);
        }

        return builder.toString();
    }
1027163
public void add(byte b, Collection c) {
		if ((c != null) && (c.size() > 0)) {
			String s2 = get(b);
            for (Object aC : c) {
                String s = (String) aC;
                if (s2 == null)
                    s2 = s;
                else
                    s2 += lineSeparator + s;
            }
			set(b, s2);
		}
	}
1196278
public static <T> Iterator<T> concat( final Iterator<T> a,
                                          final Iterator<T> b ) {
        assert (a != null);
        assert (b != null);

        return new Iterator<T>() {

            @Override
            public boolean hasNext() {
                return a.hasNext() || b.hasNext();
            }

            @Override
            public T next() {
                if (a.hasNext()) {
                    return a.next();
                }

                return b.next();
            }

            @Override
            public void remove() {
                throw new UnsupportedOperationException();
            }
        };
    }
1339405
public static String join(String separator, String[] parts) {
        StringBuilder builder = new StringBuilder();
        boolean first = true;
        for (String part : parts) {
            if (first) {
                first = false;
            } else {
                builder.append(separator);
            }
            builder.append(part);
        }
        return builder.toString();
    }
1170623
public static String format(boolean[] b, final String sep) {
    return (b == null) ? "null" : (b.length == 0) ? "" : //
        formatTo(new StringBuilder(), b, ", ").toString();
  }