Generic multi dimensional array conversion function
This function converts a 2-dimensional Collection of String to an
2-dimensional array of String:
public static String[][] toArray( Collection<? extends Collection<String>>
values ){
String[][] result = new String[ values.size() ][];
int i=0;
for( Collection<String> row : values ){
result[i] = row.toArray( new String[ row.size() ] );
i++;
}
return result;
}
How would this function be written in order to do this generic:
public static <X> X[][] ArrayArray( Collection<? extends Collection<X>>
values ){
???
}
No comments:
Post a Comment