All Downloads are FREE. Search and download functionalities are using the official Maven repository.

examples.ElisionTest Maven / Gradle / Ivy

import java.util.Vector;

public class ElisionTest
{
    public ElisionTest()
    {
        Vector vector = new Vector<>();

        for (long i = 0; i < 100_000; i++)
        {
            vector.add(i); // add is synchronized
        }

        long sum = 0;

        for (int i = 0; i < vector.size(); i++)
        {
            sum += vector.get(i);
        }

        System.out.println("ElisionTest: " + sum);
    }

    public static void main(String[] args)
    {
        new ElisionTest();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy