Java Thread Callable sum(final double[] a)

Here you can find the source of sum(final double[] a)

Description

sum

License

Open Source License

Declaration

public static Callable sum(final double[] a) throws Exception 

Method Source Code


//package com.java2s;
import java.util.concurrent.*;

public class Main {
    public static Callable sum(final double[] a) throws Exception {
        Callable c = new Callable() {
            public Object call() throws Exception {
                Double max = null;
                double[] result = new double[a.length];
                max = a[0];/*from  w w  w .ja v a2s  . c o m*/
                for (int i = 1; i < a.length; i++) {
                    max += a[i];
                }
                return max;
            }
        };
        return c;
    }
}

Related

  1. runTest(Callable test)
  2. runWithTimeout(long millisTimeout, Callable callable)
  3. shuffleRow(final double[] data)
  4. submitAndWait(ListeningExecutorService service, Callable ca)
  5. submitManyAndWait(ListeningExecutorService service, Iterable> cas, FutureCallback fca)
  6. sumOfSquares(final double[] data)
  7. waitFor(final Process process, final CyclicBarrier onStart)
  8. waitFor(Object o, long ms, Callable c)
  9. waitForCondition(Callable condition, Callable callback, int seconds)