<commit_before>package ru.sbulygin;

import java.util.Collection;
import java.util.Iterator;

/**
 * Class CollectionsTest.
 *
 * @author ru.sbulygin.
 * @since 09.04.2017.
 * @version 1.0.
 */
public class CollectionsTest {

    public long add(Collection<String> collection, String line, int amount) {

        long startTime = System.currentTimeMillis();

        for (int index = 0; index < amount; index++) {
            collection.add(line);
        }
        long finishTime = System.currentTimeMillis();
        return finishTime - startTime;
    }

    public long delete(Collection<String> collection, int amount) {

        long startTime = System.currentTimeMillis();

        Iterator<String> iterator = collection.iterator();

        for (int index = 0; index < amount; index++) {

            if (iterator.hasNext()) {
                iterator.next();
                iterator.remove();
            }
        }
        long finishTime = System.currentTimeMillis();
        return finishTime - startTime;
    }



}
<commit_msg>create method main #1<commit_after>package ru.sbulygin;

import java.util.*;

/**
 * Class CollectionsTest.
 *
 * @author ru.sbulygin.
 * @since 09.04.2017.
 * @version 1.0.
 */
public class CollectionsTest {

    public long add(Collection<String> collection, String line, int amount) {

        long startTime = System.currentTimeMillis();

        for (int index = 0; index < amount; index++) {
            collection.add(line);
        }
        long finishTime = System.currentTimeMillis();
        return finishTime - startTime;
    }

    public long delete(Collection<String> collection, int amount) {

        long startTime = System.currentTimeMillis();

        Iterator<String> iterator = collection.iterator();

        for (int index = 0; index < amount; index++) {

            if (iterator.hasNext()) {
                iterator.next();
                iterator.remove();
            }
        }
        long finishTime = System.currentTimeMillis();
        return finishTime - startTime;
    }

public static void main(String[] args) {

    CollectionsTest test = new CollectionsTest();
    LinkedList<String> linkedList = new LinkedList<>();
    ArrayList<String> arrayList = new ArrayList<>();
    TreeSet<String> treeSet = new TreeSet<>();

    System.out.println("Time adding elements: ");
    System.out.println(String.format("LinkedList: %s ms", test.add(linkedList, "element", 7_000_000)));
    System.out.println(String.format("arrayList: %s ms", test.add(arrayList, "element", 7_000_000)));
    System.out.println(String.format("treeSet: %s ms", test.add(treeSet, "element", 7_000_000)));
    linkedList.clear();
    arrayList.clear();
    treeSet.clear();

    test.add(linkedList, "element", 180_000);
    test.add(arrayList, "element", 180_000);
    test.add(treeSet, "element", 180_000);
    System.out.println();
    System.out.println("Time of delete elements: ");
    System.out.println(String.format("LinkedList: %s ms", test.delete(linkedList, 120_000)));
    System.out.println(String.format("arrayList: %s ms", test.delete(arrayList, 120_000)));
    System.out.println(String.format("treeSet: %s ms", test.delete(treeSet, 120_000)));



}

}

{'fraction_non_alphanumeric': 0.13629307668425955, 'fraction_numerical': 0.02545793231915554, 'mean_word_length': 2.8586826347305387, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 15, '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': '1094488', 'n_tokens_mistral': 997, 'n_tokens_neox': 912, 'n_words': 217}