<commit_before>/*
 * Copyright 2012 Splunk, Inc.
 *
 * 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.splunk;

import java.util.Arrays;
import java.util.List;

public class Util {
    /**
     * Join the strings in {@code joinees}, separated by {@code joiner}.
     *
     * For example, {@code join("/", list)} where {@code list} contains the strings {@code "a"},
     * {@code "b"}, and {@code "c"} returns "a/b/c";
     *
     * @param joiner String to interpolate between each element of {@code joinees}.
     * @param joinees List of strings to join.
     * @return The strines in {@code joinees} concatenated with a copy of {@code joiner} between each.
     */
    public static String join(String joiner, List<String> joinees) {
        if (joinees.isEmpty()) {
            return "";
        } else {
            String joined = joinees.get(0);
            for (String s : joinees.subList(1, joinees.size())) {
                joined = joined + joiner + s;
            }
            return joined;
        }
    }

    public static String join(String joiner, String[] joinees) {
        return join(joiner, Arrays.asList(joinees));
    }

    /**
     * Return the substring of {@code template} beginning after {@code toFind}
     * occurs, or {@code defaultTo} if {@code toFind} does not occur. For example,
     * {@code substringAfter("This is a test", "is a", "abcd")} returns {@code " test"},
     * while {@code substringAfter("This is a test", "boris", "abcd")} returns {@code "abcd"}.
     *
     *
     * @param template String to search in.<commit_msg>Replaced String with StringBuilder in Util.join<commit_after>/*
 * Copyright 2012 Splunk, Inc.
 *
 * 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.splunk;

import java.util.Arrays;
import java.util.List;

public class Util {
    /**
     * Join the strings in {@code joinees}, separated by {@code joiner}.
     *
     * For example, {@code join("/", list)} where {@code list} contains the strings {@code "a"},
     * {@code "b"}, and {@code "c"} returns "a/b/c";
     *
     * @param joiner String to interpolate between each element of {@code joinees}.
     * @param joinees List of strings to join.
     * @return The strines in {@code joinees} concatenated with a copy of {@code joiner} between each.
     */
    public static String join(String joiner, List<String> joinees) {
        if (joinees.isEmpty()) {
            return "";
        } else {
            StringBuilder joined = new StringBuilder();
            joined.append(joinees.get(0));
            for (String s : joinees.subList(1, joinees.size())) {
                joined.append(joiner);
                joined.append(s);
            }
            return joined.toString();
        }
    }

    public static String join(String joiner, String[] joinees) {
        return join(joiner, Arrays.asList(joinees));
    }

    /**
     * Return the substring of {@code template} beginning after {@code toFind}
     * occurs, or {@code defaultTo} if {@code toFind} does not occur. For example,
     * {@code substringAfter("This is a test", "is a", "abcd")} returns {@code " test"},
     * while {@code substringAfter("This is a test", "boris", "abcd")} returns {@code "abcd"}.
     *
     *
     * @param template String to search in.
{'fraction_non_alphanumeric': 0.11731973104567586, 'fraction_numerical': 0.004637143519591932, 'mean_word_length': 2.7189655172413794, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2238711', 'n_tokens_mistral': 1229, 'n_tokens_neox': 1189, 'n_words': 484}