package ru.matevosyan;

import java.util.*;

public class EfficiencyList {

    private long efficiencyTime;



    public long add(Collection<String> collection, String line, int amount) {
        this.efficiencyTime = System.currentTimeMillis();
        for(int i = 0; i < amount; i++) {
            collection.add(line + i);
        }
        return this.efficiencyTime = System.currentTimeMillis() - this.efficiencyTime;
    }
    public long delete(Collection<String> collection, int amount) {
        this.efficiencyTime = System.currentTimeMillis();

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

        int i = 0;
        while(iterator.hasNext() && (i < amount)) {

            iterator.next();
            iterator.remove();
            i++;
        }
        return this.efficiencyTime = System.currentTimeMillis() - this.efficiencyTime;
    }

}

@@ -17,16 +17,17 @@
 osyan;%0A%0A
+%0A
 import j
@@ -39,9 +39,45 @@
 til.
-*
+Collection;%0Aimport java.util.Iterator
 ;%0A%0Ap

change import