<commit_before>package me.st28.flexseries.flexcore.utils;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

/**
 * Various utility methods for Strings.
 */
public final class StringUtils {

    private StringUtils() { }

    public static <T> String collectionToString(Collection<T> collection, StringConverter<T> converter) {
        return collectionToString(collection, converter, " ");
    }

    public static <T> String collectionToString(Collection<T> collection, StringConverter<T> converter, String delimiter) {
        if (collection == null) return "";
        StringBuilder sb = new StringBuilder();
        for (T item : collection) {
            if (sb.length() > 0) {
                sb.append(delimiter);
            }
            sb.append(converter.toString(item));
        }
        return sb.toString();
    }

    public static String stringCollectionToString(Collection<String> collection) {
        return stringCollectionToString(collection, " ");
    }

    /**<commit_msg>Added methods to convert collections into string collections.<commit_after>package me.st28.flexseries.flexcore.utils;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

/**
 * Various utility methods for Strings.
 */
public final class StringUtils {

    private StringUtils() { }

    public static <T> String collectionToString(Collection<T> collection, StringConverter<T> converter) {
        return collectionToString(collection, converter, " ");
    }

    public static <T> String collectionToString(Collection<T> collection, StringConverter<T> converter, String delimiter) {
        if (collection == null) return "";
        StringBuilder sb = new StringBuilder();
        for (T item : collection) {
            if (sb.length() > 0) {
                sb.append(delimiter);
            }
            sb.append(converter.toString(item));
        }
        return sb.toString();
    }

    public static <T> List<String> collectionToStringList(Collection<T> collection, StringConverter<T> converter) {
        List<String> returnList = new ArrayList<>();
        for (T item : collection) {
            returnList.add(converter.toString(item));
        }
        return returnList;
    }

    public static <T, F extends Collection<String>>  F collectionToStringCollection(Collection<T> collection, StringConverter<T> converter, F returnCollection) {
        for (T item : collection) {
            returnCollection.add(converter.toString(item));
        }
        return returnCollection;
    }

    public static String stringCollectionToString(Collection<String> collection) {
        return stringCollectionToString(collection, " ");
    }

    /**
{'fraction_non_alphanumeric': 0.10628907686649504, 'fraction_numerical': 0.002206693637366679, 'mean_word_length': 3.0, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '2403876', 'n_tokens_mistral': 698, 'n_tokens_neox': 671, 'n_words': 178}