Java List Create createCategoryName(List names)

Here you can find the source of createCategoryName(List names)

Description

Simple helper method that concatenates the names of a row of categories.

License

Open Source License

Declaration

static String createCategoryName(List<String> names) 

Method Source Code

//package com.java2s;
/*// w  w w  .  ja v a 2s  .c  om
 * Copyright (c) 2009, SQL Power Group Inc.
 *
 * This file is part of Wabit.
 *
 * Wabit is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 3 of the License, or
 * (at your option) any later version.
 *
 * Wabit 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>. 
 */

import java.util.List;

public class Main {
    /**
     * This separator is used to separate category names when more then one
     * column is selected as the category in a bar chart.
     */
    private static final String CATEGORY_SEPARATOR = ", ";

    /**
     * Simple helper method that concatenates the names of a row of categories.
     * This way all of the category names are consistent.
     */
    static String createCategoryName(List<String> names) {
        StringBuilder sb = new StringBuilder();
        if (names.size() == 0)
            return "";
        sb.append(names.get(0));
        for (int i = 1; i < names.size(); i++) {
            sb.append(CATEGORY_SEPARATOR + names.get(i));
        }
        return sb.toString();
    }
}

Related

  1. createArrayFromUsers(List userList)
  2. createArrayList()
  3. createBarrier(List text)
  4. createBlankSet(String date, List titleList)
  5. createBVQueryParametersList()
  6. createChancePrefixList(List chances)
  7. createClassList(List objects)
  8. createColumnsToken(List columnnames)
  9. createCommaList(List values, int rowCharacterCount)

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