Java List Concatenate concatWithSeparator(List missingParameters, String separator)

Here you can find the source of concatWithSeparator(List missingParameters, String separator)

Description

concat With Separator

License

Open Source License

Declaration

public static String concatWithSeparator(List<String> missingParameters, String separator) 

Method Source Code

//package com.java2s;
/*/*w w w  .ja  va  2 s.  c om*/
 * Copyright ? 2008, 2012 Pedro Agull? Soliveres.
 * 
 * This file is part of DirectJNgine.
 *
 * DirectJNgine is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License.
 *
 * Commercial use is permitted to the extent that the code/component(s)
 * do NOT become part of another Open Source or Commercially developed
 * licensed development library or toolkit without explicit permission.
 *
 * DirectJNgine is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with DirectJNgine.  If not, see <http://www.gnu.org/licenses/>.
 * 
 * This software uses the ExtJs library (http://extjs.com), which is 
 * distributed under the GPL v3 license (see http://extjs.com/license).
 */

import java.util.List;

public class Main {
    public static String concatWithSeparator(List<String> missingParameters, String separator) {
        assert missingParameters != null;
        assert separator != null;

        if (missingParameters.isEmpty()) {
            return "";
        }

        StringBuilder result = new StringBuilder();
        for (int i = 0; i < missingParameters.size() - 1; i++) {
            result.append(missingParameters.get(i));
            result.append(separator);
        }

        result.append(missingParameters.get(missingParameters.size() - 1));

        return result.toString();
    }

    public static boolean isEmpty(String value) {
        return value == null || value.equals("");
    }
}

Related

  1. concatSuper(List collection1, List collection2)
  2. concatSynopsises( List prefixes, List ss)
  3. concatTwoList(List fromList, List toList)
  4. concatValues(List stringValues, boolean spaceSeparated)
  5. concatWithSeparator(List list, Object delimiter)
  6. getConcatenatedStringFromList(List input, String delimiter)
  7. getConcatenateString(List codes)
  8. getConcatinatedRange(List numbers)
  9. getZipAndConcatenated(List input1, List input2, String delimiter)