Java Collection Join join(final Collection list, final String inbetween)

Here you can find the source of join(final Collection list, final String inbetween)

Description

join

License

Open Source License

Declaration

@SuppressWarnings("unused")
    public static String join(final Collection<?> list, final String inbetween) 

Method Source Code


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

import java.util.Collection;

public class Main {
    @SuppressWarnings("unused")
    public static String join(final Collection<?> list, final String inbetween) {
        final StringBuilder builder = new StringBuilder();
        for (final Object object : list) {
            if (builder.length() > 0) {
                builder.append(inbetween);
            }/*from   w ww  .j av a2  s  .com*/
            builder.append(object.toString());
        }
        return builder.toString();
    }
}

Related

  1. join(final Collection e, final String s)
  2. join(final Collection items, final String glue)
  3. join(final Collection coll, final String delimiter)
  4. join(final Collection coll, final String glue)
  5. join(final Collection items, final String inBetween)
  6. join(final Collection strings, String delimeter)
  7. join(final Collection values, final String separator)
  8. join(final Collection aStrings, final String aSeparator)
  9. join(final Collection chunks, final String delimiter)

  10. HOME | Copyright © www.java2s.com 2016