Here you can find the source of createMultiSelectionValue(List
Parameter | Description |
---|---|
values | list of option values |
public static String createMultiSelectionValue(List<String> values)
//package com.java2s; /*/*from w ww .j a v a2 s . c o m*/ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" * which accompanies this distribution, and is available * at the URL "http://www.eclipse.org/legal/epl-v10.html". * * Initial Contributors: * Nokia Corporation - Initial contribution * * Contributors: * * Description: This file is part of com.nokia.tools.variant.viewer component. */ import java.util.Collections; import java.util.List; public class Main { /** * * @param values list of option values * @return multiselection value combined from values list * * example: * List<String> = [A,X,Z] * * retuns "A" "X" "Z" * */ public static String createMultiSelectionValue(List<String> values) { Collections.sort(values); StringBuilder sb = new StringBuilder(); for (int i = 0; i < values.size(); i++) { if (i > 0) { sb.append(' '); } sb.append("\"" + values.get(i) + "\""); } return sb.toString(); } }