/**
 * Copyright Microsoft Corporation
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.microsoft.windowsazure.core.utils;

import com.sun.deploy.util.StringUtils;

import java.util.List;

public class CollectionStringBuilder {
    private final StringBuilder sb;
    private static String separator;

    public CollectionStringBuilder() {
        sb = new StringBuilder();
        separator = ",";
    }

    public CollectionStringBuilder(String separator) {
        sb = new StringBuilder();
        CollectionStringBuilder.separator = separator;
    }

    public void add(String representation) {
        if (sb.length() > 0) {
            sb.append(separator);
        }
        sb.append(representation);
    }

    public void addValue(boolean value, String representation) {
        if (value) {
            add(representation);
        }
    }

    public static String join(List<String> values) {
        return StringUtils.join(values, separator);
    }

    public static String join(List<String> values, String separator) {
        return StringUtils.join(values, separator);
    }

    public static String join(String... values) {
        CollectionStringBuilder sb = new CollectionStringBuilder();

        for (String value : values) {
            sb.add(value);
        }

        return sb.toString();
    }

    @Override
    public String toString() {
        if (sb.length() == 0) {
            return null;
        }

        return sb.toString();
    }
}

@@ -741,16 +741,73 @@
 ilder %7B%0A
+    private static final String DEFAULT_SEPARATOR = %22,%22;%0A
     priv
@@ -965,19 +965,33 @@
 rator = 
-%22,%22
+DEFAULT_SEPARATOR
 ;%0A    %7D%0A

use const for default separator