chapter_002/src/main/java/ru/job4j/PerformanceCollections.java
public long add(Collection<String> collection, int amount) {
        long startTime = System.currentTimeMillis();

        for (int i = 0; i < amount; i++) {
            collection.add("test".concat(String.valueOf(i)));
        }

        long currentTime = System.currentTimeMillis();
        return currentTime - startTime;
    }
/**
     * Add to collection.
     *
     * @param collection Test Collection
     * @param amount     int amount elements need add to collection
     * @return long.
     */
Add to collection.
@param collection Test Collection
@param amount     int amount elements need add to collection
@return long.
Add to collection . @param collection Test Collection @param amount int amount elements need add to collection @return long .
public long add(Collection<String> collection, int amount) {
        long startTime = System.currentTimeMillis();
        for (int i = 0; i < amount; i++) {
            collection.add("test".concat(String.valueOf(i)));
        }
        long currentTime = System.currentTimeMillis();
        return currentTime - startTime;
    }
public long add ( Collection < String > collection , int amount ) { long startTime = System . currentTimeMillis ( ) ; for ( int i = 0 ; i < amount ; i ++ ) { collection . add ( "test" . concat ( String . valueOf ( i ) ) ) ; } long currentTime = System . currentTimeMillis ( ) ; return currentTime - startTime ; }
Add to collection.
Add to collection .