Example usage for java.util Vector Vector

List of usage examples for java.util Vector Vector

Introduction

In this page you can find the example usage for java.util Vector Vector.

Prototype

public Vector(Collection<? extends E> c) 

Source Link

Document

Constructs a vector containing the elements of the specified collection, in the order they are returned by the collection's iterator.

Usage

From source file:edu.umd.cs.psl.reasoner.admm.SquaredLinearLossTermTest.java

private void testProblem(double[] z, double[] y, double[] coeffs, double constant, double weight,
        final double stepSize, double[] expected) {
    config.setProperty("admmreasoner.stepsize", stepSize);
    ADMMReasoner reasoner = new ADMMReasoner(config);
    reasoner.z = new Vector<Double>(z.length);
    for (int i = 0; i < z.length; i++)
        reasoner.z.add(z[i]);// ww w .jav a  2  s  .c  om

    int[] zIndices = new int[z.length];
    for (int i = 0; i < z.length; i++)
        zIndices[i] = i;
    SquaredLinearLossTerm term = new SquaredLinearLossTerm(reasoner, zIndices, coeffs, constant, weight);
    for (int i = 0; i < z.length; i++)
        term.y[i] = y[i];
    term.minimize();

    for (int i = 0; i < z.length; i++)
        assertEquals(expected[i], term.x[i], 5e-5);
}

From source file:com.hphoto.util.ThreadPool.java

/**
 * Creates a pool of numThreads size./*w w w.  jav  a 2  s.  c  o m*/
 * These threads sit around waiting for jobs to
 * be posted to the list.
 */
public ThreadPool(int numThreads) {
    this.numThreads = numThreads;
    jobs = new Vector(37);
    running = true;

    for (int i = 0; i < numThreads; i++) {
        TaskThread t = new TaskThread();
        t.start();
    }
    Log l = LogFactory.getLog(ThreadPool.class.getName());
    l.fatal("ThreadPool created with " + numThreads + " threads.");
}