1
0
Fork 0
mirror of https://github.com/graphhopper/jsprit.git synced 2020-01-24 07:45:05 +01:00

add toPrimitiveArray(Collection)

This commit is contained in:
oblonski 2015-02-23 22:12:28 +01:00
parent 323dbbfa87
commit 67b67b8c45

View file

@ -16,6 +16,7 @@
******************************************************************************/
package jsprit.core.util;
import java.util.Collection;
import java.util.List;
public class ArrayUtils {
@ -25,5 +26,15 @@ public class ArrayUtils {
for(int i=0;i<list.size();i++) arr[i]=list.get(i);
return arr;
}
public static double[] toPrimitiveArray(Collection<Double> collection){
double[] arr = new double[collection.size()];
int i=0;
for(Double d : collection){
arr[i]=d;
i++;
}
return arr;
}
}