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:
parent
323dbbfa87
commit
67b67b8c45
1 changed files with 11 additions and 0 deletions
|
|
@ -16,6 +16,7 @@
|
|||
******************************************************************************/
|
||||
package jsprit.core.util;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
public class ArrayUtils {
|
||||
|
|
@ -26,4 +27,14 @@ public class ArrayUtils {
|
|||
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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue