<commit_before>package se.blea.flexiconf.cli;

import se.blea.flexiconf.ConfigOptions;
import se.blea.flexiconf.Schema;
import se.blea.flexiconf.SchemaOptions;
import se.blea.flexiconf.javaapi.*;

import java.util.List;

/**
 * @author <NAME> (<EMAIL>)
 */
public class JavaCLI {
    public static void main(String[] args) {
        SchemaOptions schemaOpts = SchemaOptions.withSourceFile("src/main/resources/sample_schema.conf");
        Schema schema = Parser.parseSchema(schemaOpts);

        ConfigOptions configOpts = ConfigOptions.withSourceFile("src/main/resources/sample_config.conf")
            .ignoreUnknownDirectives()
            .ignoreMissingGroups()
            .withSchema(schema);

        Config config = Parser.parseConfig(configOpts);

        printArgs(config.getDirectives());

        System.out.println("default > connectTimeout > " + config.getDirective("defaults")
                .getDirective("connectTimeout")
                .getIntArg("ms"));

        System.out.println("Filtered args");

        printArgs(config.getDirectives("defaults", "destination"));

        System.out.println(config.renderTree());
        System.out.println(config.getWarnings().size());
        config.getWarnings().forEach(System.out::println);
    }

    private static void printArgs(List<Directive> nodes) {
        nodes.forEach((node) -> {
            System.out.println(node.getName());
            node.getArgs().forEach((arg) -> {
                System.out.println(String.format(">> %s: %s", arg.getName(), arg.getKind()));
            });

            printArgs(node.getDirectives());
        });
    }<commit_msg>Remove forEach calls for Java 7 support<commit_after>package se.blea.flexiconf.cli;

import se.blea.flexiconf.ConfigOptions;
import se.blea.flexiconf.Schema;
import se.blea.flexiconf.SchemaOptions;
import se.blea.flexiconf.javaapi.*;

import java.util.List;

/**
 * @author <NAME> (<EMAIL>)
 */
public class JavaCLI {
    public static void main(String[] args) {
        SchemaOptions schemaOpts = SchemaOptions.withSourceFile("src/main/resources/sample_schema.conf");
        Schema schema = Parser.parseSchema(schemaOpts);

        ConfigOptions configOpts = ConfigOptions.withSourceFile("src/main/resources/sample_config.conf")
            .ignoreUnknownDirectives()
            .ignoreMissingGroups()
            .withSchema(schema);

        Config config = Parser.parseConfig(configOpts);

        printArgs(config.getDirectives());

        System.out.println("default > connectTimeout > " + config.getDirective("defaults")
                .getDirective("connectTimeout")
                .getIntArg("ms"));

        System.out.println("Filtered args");

        printArgs(config.getDirectives("defaults", "destination"));

        System.out.println(config.renderTree());
        System.out.println(config.getWarnings().size());

        for (String warning : config.getWarnings()) {
            System.out.println(warning);
        }
    }

    private static void printArgs(List<Directive> nodes) {
        for (Directive node : nodes) {
            System.out.println(node.getName());
            for (Argument arg : node.getArgs()) {
                System.out.println(String.format(">> %s: %s", arg.getName(), arg.getKind()));
            }

            printArgs(node.getDirectives());
        }
    }
{'fraction_non_alphanumeric': 0.13701492537313434, 'fraction_numerical': 0.00029850746268656717, 'mean_word_length': 2.8209806157354618, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 19, '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': '4146125', 'n_tokens_mistral': 944, 'n_tokens_neox': 930, 'n_words': 146}