<commit_before>package nl.mvdr.javafx8sandbox;

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

/**
 * Playing around with Collectors for fun. (Not really related to JavaFX.)
 * 
 * @author <NAME>
 */
public class CollectorSandbox {
    /**
     * Main method.
     * 
     * @param args command line parameters; these are ignored
     */
    public static void main(String[] args) {
        List<String> names = Arrays.asList("Jan", "Klaas", "Piet", "Ton", "Kees", "Sjaak", "Herman", "en", "nog", "meer", "namen");

        long start = System.currentTimeMillis();
        
        String string = names
                .parallelStream()
                .collect(CollectorSandbox::supply, CollectorSandbox::accumulate, CollectorSandbox::combine)
                .toString();
        System.out.println(string);
        
        System.out.println("Time spent: " + (System.currentTimeMillis() - start) + "milliseconds.");
    }
    
    /**
     * Supplies a new string builder.
     * 
     * @return
     */
    private static StringBuilder supply() {
        System.out.println(Thread.currentThread().getName() + " - Creating new string buffer.");
        return new StringBuilder();
    }
    
    /**
     * Accumulates the given string into the given string builder.
     * 
     * @param builder builder
     * @param string string
     */
    private static void accumulate(StringBuilder builder, String string) {
        System.out.println(Thread.currentThread().getName() + " - Appending to " + builder + ": " + string);
        
        try {
            Thread.sleep(1_000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        
        builder.append(string);
    }
    
    /**
     * Combines the given builders.
     * 
     * @param builder0 builder
     * @param builder1 builder
     */
    private static void combine(StringBuilder builder0, StringBuilder builder1) {
        System.out.println(Thread.currentThread().getName() + " - Combining " + builder0 + " and " + builder1);
        builder0.append(builder1);
    }
}<commit_msg>Extracted a log method.<commit_after>package nl.mvdr.javafx8sandbox;

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

/**
 * Playing around with Collectors for fun. (Not really related to JavaFX.)
 * 
 * @author <NAME>
 */
public class CollectorSandbox {
    /**
     * Main method.
     * 
     * @param args command line parameters; these are ignored
     */
    public static void main(String[] args) {
        List<String> names = Arrays.asList("Jan", "Klaas", "Piet", "Ton", "Kees", "Sjaak", "Herman", "en", "nog", "meer", "namen");

        long start = System.currentTimeMillis();
        
        String string = names
                .parallelStream()
                .collect(CollectorSandbox::supply, CollectorSandbox::accumulate, CollectorSandbox::combine)
                .toString();
        System.out.println(string);
        
        System.out.println("Time spent: " + (System.currentTimeMillis() - start) + "milliseconds.");
    }
    
    /**
     * Supplies a new string builder.
     * 
     * @return
     */
    private static StringBuilder supply() {
        log("Creating new string buffer.");
        return new StringBuilder();
    }
    
    /**
     * Accumulates the given string into the given string builder.
     * 
     * @param builder builder
     * @param string string
     */
    private static void accumulate(StringBuilder builder, String string) {
        log("Appending to " + builder + ": " + string);
        
        try {
            Thread.sleep(1_000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        
        builder.append(string);
    }
    
    /**
     * Combines the given builders.
     * 
     * @param builder0 builder
     * @param builder1 builder
     */
    private static void combine(StringBuilder builder0, StringBuilder builder1) {
        log("Combining " + builder0 + " and " + builder1);
        builder0.append(builder1);
    }
    
    /**
     * Logs the given message.
     * 
     * @param message message
     */
    private static void log(String message) {
        System.out.println(Thread.currentThread().getName() + " - " + message);
    }
}
{'fraction_non_alphanumeric': 0.12356389214536928, 'fraction_numerical': 0.0060961313012895665, 'mean_word_length': 2.146017699115044, 'pattern_counts': {'":': 2, '<': 7, '<?xml version=': 0, '>': 7, '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': '5561014', 'n_tokens_mistral': 1219, 'n_tokens_neox': 1183, 'n_words': 298}