<commit_before>package chikachi.discord.core.config.validator.rules;

import chikachi.discord.core.config.Configuration;
import chikachi.discord.core.config.validator.IConfigurationValidationRule;
import chikachi.discord.core.config.validator.ValidationResult;
import com.google.common.base.Joiner;

import java.util.Map;

public class ChannelCommandPrefixEmptyRule implements IConfigurationValidationRule {
    private String getHint() {
        return "For at least one channel there is 'canExecuteCommands' set to true and the 'commandPrefix' is set to an empty string. " +
            "You should always specify a prefix.";
    }

    @Override
    public ValidationResult validate() {
        Long[] invalidElements = Configuration.getConfig().discord.channels.channels
            .entrySet()
            .stream()
            .filter(entry -> entry.getValue() != null && entry.getKey() != null)
            .filter(entry -> entry.getValue().canExecuteCommands)
            .filter(entry -> entry.getValue().commandPrefix != null)
            .filter(entry -> entry.getValue().commandPrefix.trim().equals(""))
            .map(Map.Entry::getKey)
            .toArray(Long[]::new);

        if (invalidElements.length == 0) {
            return new ValidationResult(true, null);
        } else {
            return new ValidationResult(
                false,
                getHint() + " Channel(s): " + Joiner.on(", ").join(invalidElements)
            );
        }
    }
}
<commit_msg>Converted a stream to a loop; This should show whether the bug is in the (official) array lib or not<commit_after>package chikachi.discord.core.config.validator.rules;

import chikachi.discord.core.config.Configuration;
import chikachi.discord.core.config.discord.DiscordChannelConfig;
import chikachi.discord.core.config.validator.IConfigurationValidationRule;
import chikachi.discord.core.config.validator.ValidationResult;
import com.google.common.base.Joiner;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

public class ChannelCommandPrefixEmptyRule implements IConfigurationValidationRule {
    private String getHint() {
        return "For at least one channel there is 'canExecuteCommands' set to true and the 'commandPrefix' is set to an empty string. " +
            "You should always specify a prefix.";
    }

    @Override
    public ValidationResult validate() {
        List<Long> list = new ArrayList<>();
        for (Map.Entry<Long, DiscordChannelConfig> entry : Configuration.getConfig().discord.channels.channels.entrySet()) {
            if (entry.getValue().canExecuteCommands
                && entry.getValue().commandPrefix != null
                && entry.getValue().commandPrefix.trim().equals("")
                ) {
                Long key = entry.getKey();
                list.add(key);
            }
        }

        if (list.size() == 0) {
            return new ValidationResult(true, null);
        } else {
            return new ValidationResult(
                false,
                getHint() + " Channel(s): " + Joiner.on(", ").join(list)
            );
        }
    }
}

{'fraction_non_alphanumeric': 0.11118190506530742, 'fraction_numerical': 0.0006371455877668047, 'mean_word_length': 2.6050516647531574, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 10, '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': '4560400', 'n_tokens_mistral': 828, 'n_tokens_neox': 820, 'n_words': 196}