Java Collection Join join(Collection values, String join)

Here you can find the source of join(Collection values, String join)

Description

join

License

Apache License

Declaration

public static <T> String join(Collection<T> values, String join) 

Method Source Code


//package com.java2s;
// Licensed under the Apache License, Version 2.0 (the "License");

import java.util.Collection;

public class Main {
    public static <T> String join(Collection<T> values, String join) {
        StringBuilder result = new StringBuilder();

        String delim = "";
        for (T value : values) {
            result.append(delim);/*from   ww  w .j  a v a 2 s.c  o m*/
            result.append(value == null ? "null" : value.toString());
            delim = join;
        }

        return result.toString();
    }
}

Related

  1. join(Collection collections, String separator)
  2. join(Collection list, final String separator)
  3. join(Collection list, String delimiter)
  4. join(Collection s, String delimiter)
  5. join(Collection things, String delim)
  6. join(final char _separator, final boolean _quotes, final Collection _list, final String _emptyString)
  7. join(final Collection collection, String delimiter)
  8. join(final Collection e, final String s)
  9. join(final Collection items, final String glue)